Debian Codegraph @

clang/test/Sema/invalid-member.cpp

raw
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 expected-note {{declared here}}
25 template<int a>
26 class ABC {};
27 class 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 };
31 static_assert(sizeof(T) == 1, "No valid members");