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