[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / cxx11-brace-initializers.cpp
blob820344c578364cb2ca68e4f28f70d4ca36162ded
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
3 struct S {
4 S(int, int) {}
5 };
7 void f(int, S const&, int) {}
9 void test1()
11 S X1{1, 1,};
12 S X2 = {1, 1,};
14 f(0, {1, 1}, 0);
17 namespace PR14948 {
18 template<typename T> struct Q { static T x; };
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 };
25 template<typename T> T Q<T>::x {};
28 int conditional1 = 1 ? {} : 0; // expected-error {{initializer list cannot be used on the right hand side of operator '?'}}
29 int conditional2 = 1 ? 0 : {}; // expected-error {{initializer list cannot be used on the right hand side of operator ':'}}