xref: /llvm-project/clang/test/SemaCXX/PR20334-std_initializer_list_diagnosis_assertion.cpp (revision 482c41e992c1edf8833a4577b56ff9dda49fbc83)
1 // RUN: %clang_cc1 -std=c++11 -verify=cxx11 -emit-llvm-only %s
2 // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify=cxx98 %s
3 // RUN: %clang_cc1 -std=c++11 -verify=cxx11 -emit-llvm-only %s -fexperimental-new-constant-interpreter
4 // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify=cxx98 %s -fexperimental-new-constant-interpreter
5 
6 
7 namespace std {
8   template <class _E>
9   class initializer_list {};
10   // cxx11-error@-1 {{'std::initializer_list<int>' layout not recognized. Must be a non-polymorphic class type with no bases and two fields: a 'const E *' and either another 'const E *' or a 'std::size_t'}}
11 }
12 
13 template<class E> int f(std::initializer_list<E> il);
14 
15 
16 int F = f({1, 2, 3});
17 // cxx98-error@-1 {{expected expression}}
18