1 // RUN: %clang_cc1 -std=c++20 -fexperimental-new-constant-interpreter -verify=expected,both %s 2 // RUN: %clang_cc1 -std=c++20 -verify=ref,both %s 3 4 [[gnu::weak]] extern int a; 5 int ha[(bool)&a]; // both-warning {{variable length arrays in C++ are a Clang extension}} \ 6 // both-error {{variable length array declaration not allowed at file scope}} 7 int ha2[&a == nullptr]; // both-warning {{variable length arrays in C++ are a Clang extension}} \ 8 // both-note {{comparison against address of weak declaration '&a' can only be performed at runtime}} \ 9 // both-error {{variable length array declaration not allowed at file scope}} 10 11 extern const int W1 __attribute__((weak)) = 10; // both-note {{declared here}} 12 static_assert(W1 == 10, ""); // both-error {{static assertion expression is not an integral constant expression}} \ 13 // both-note {{initializer of weak variable 'W1' is not considered constant because it may be different at runtime}} 14 15 extern const int W2 __attribute__((weak)); // both-note {{declared here}} 16 static_assert(W2 == 10, ""); // both-error {{static assertion expression is not an integral constant expression}} \ 17 // both-note {{initializer of 'W2' is unknown}} 18