[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / invalid-member.cpp
blob57ee187ccf4d5a4521dd266a18a4a59a8088c1e7
1 // RUN: %clang_cc1 -verify -fsyntax-only -fno-recovery-ast %s
2 // RUN: %clang_cc1 -verify -fsyntax-only -frecovery-ast %s
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");
11 class Y {
12 typeof(foo(42)) invalid; // expected-error {{no matching function}}
14 // Should be able to evaluate sizeof without crashing.
15 static_assert(sizeof(Y) == 1, "No valid members");
17 class Z {
18 int array[sizeof(invalid())]; // expected-error {{use of undeclared identifier}}
20 // Should be able to evaluate sizeof without crashing.
21 static_assert(sizeof(Z) == 1, "No valid members");
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;
29 static_assert(sizeof(T) == 1, "No valid members");