Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / expr / expr.unary / expr.sizeof / p5-0x.cpp
blobafd8ef05302fc6351f43491675bbcc29f55db9b2
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
3 // Test parsing + semantic analysis
4 template<typename ...Types> struct count_types {
5 static const unsigned value = sizeof...(Types);
6 };
8 template<int ...Values> struct count_ints {
9 static const unsigned value = sizeof...(Values);
12 // Test instantiation
13 int check_types[count_types<short, int, long>::value == 3? 1 : -1];
14 int check_ints[count_ints<1, 2, 3, 4, 5>::value == 5? 1 : -1];
16 // Test instantiation involving function parameter packs.
17 struct any {
18 template<typename T> any(T);
21 template<typename ...Inits>
22 void init_me(Inits ...inits) {
23 any array[sizeof...(inits)] = { inits... };
26 template void init_me<int, float, double*>(int, float, double*);
28 // Test parser and semantic recovery.
29 template<int Value> struct count_ints_2 {
30 static const unsigned value = sizeof...(Value); // expected-error{{'Value' does not refer to the name of a parameter pack}}
33 template<typename ...Types> // expected-note{{parameter pack 'Types' declared here}}
34 struct count_types_2 {
35 static const unsigned value = sizeof... Type; // expected-error{{missing parentheses around the size of parameter pack 'Type'}} \
36 // expected-error{{Type' does not refer to the name of a parameter pack; did you mean 'Types'?}}