| 1 |
// RUN: %clang_cc1 -verify -fsyntax-only %s |
| 2 |
|
| 3 |
static int *z[1] = {({ static int _x = 70; &_x; })}; // expected-error {{statement expression not allowed at file scope}} |
| 4 |
|
| 5 |
void T1(void) { |
| 6 |
int *x[1] = {({ static int _x = 10; &_x; })}; // expected-no-error |
| 7 |
|
| 8 |
/* Before commit |
| 9 |
683e83c5 [Clang][C++23] P2242R3: Non-literal variables [...] in constexpr |
| 10 |
(i.e in clang-14 and earlier) |
| 11 |
this was silently accepted, but generated incorrect code. |
| 12 |
*/ |
| 13 |
static int *y[1] = {({ static int _x = 20; &_x; })}; // expected-error {{initializer element is not a compile-time constant}} |
| 14 |
} |