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