1 // RUN: %clang_cc1 -verify -fsyntax-only -fno-recovery-ast %s
2 // RUN: %clang_cc1 -verify -fsyntax-only -frecovery-ast %s
3 
4 void foo(); // expected-note 2{{requires 0 arguments}}
5 class X {
6   decltype(foo(42)) invalid; // expected-error {{no matching function}}
7 };
8 // Should be able to evaluate sizeof without crashing.
9 static_assert(sizeof(X) == 1, "No valid members");
10 
11 class Y {
12   typeof(foo(42)) invalid; // expected-error {{no matching function}}
13 };
14 // Should be able to evaluate sizeof without crashing.
15 static_assert(sizeof(Y) == 1, "No valid members");
16 
17 class Z {
18   int array[sizeof(invalid())]; // expected-error {{use of undeclared identifier}}
19 };
20 // Should be able to evaluate sizeof without crashing.
21 static_assert(sizeof(Z) == 1, "No valid members");
22 
23 constexpr int N = undef; // expected-error {{use of undeclared identifier}}
24 template<int a>
25 class ABC {};
26 class T {
27   ABC<N> abc;
28 };
29 static_assert(sizeof(T) == 1, "No valid members");
30