Clang Project

clang_source_code/test/Parser/cxx11-brace-initializers.cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
2
3struct S {
4  S(int, int) {}
5};
6
7void f(int, S const&, int) {}
8
9void test1()
10{
11  S X1{1, 1,};
12  S X2 = {1, 1,};
13
14  f(0, {1, 1}, 0);
15}
16
17namespace PR14948 {
18  template<typename T> struct Q { static T x; };
19
20  struct X {};
21  template<> X Q<X>::x {};
22  template<> int Q<int[]>::x[] { 1, 2, 3 };
23  template<> int Q<int>::x { 1 };
24
25  template<typename T> T Q<T>::x {};
26}
27
28int conditional1 = 1 ? {} : 0; // expected-error {{initializer list cannot be used on the right hand side of operator '?'}}
29int conditional2 = 1 ? 0 : {}; // expected-error {{initializer list cannot be used on the right hand side of operator ':'}}
30