mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 04:56:06 +00:00

During the ISO C++ Committee meeting plenary session the C++23 Standard has been voted as technical complete. This updates the reference to c++2b to c++23 and updates the __cplusplus macro. Drive-by fixes c++1z -> c++17 and c++2a -> c++20 when seen. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D149553
15 lines
585 B
C
15 lines
585 B
C
// RUN: %clang_cc1 -verify -fsyntax-only %s
|
|
|
|
static int *z[1] = {({ static int _x = 70; &_x; })}; // expected-error {{statement expression not allowed at file scope}}
|
|
|
|
void T1(void) {
|
|
int *x[1] = {({ static int _x = 10; &_x; })}; // expected-no-error
|
|
|
|
/* Before commit
|
|
683e83c5 [Clang][C++23] P2242R3: Non-literal variables [...] in constexpr
|
|
(i.e in clang-14 and earlier)
|
|
this was silently accepted, but generated incorrect code.
|
|
*/
|
|
static int *y[1] = {({ static int _x = 20; &_x; })}; // expected-error {{initializer element is not a compile-time constant}}
|
|
}
|