1 // RUN: %clang_cc1 -verify -std=c++23 -Wpre-c++23-compat %s
3 constexpr int h(int n
) {
6 static const int m
= n
; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
10 constexpr int i(int n
) {
13 thread_local
const int m
= n
; // expected-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
18 goto test
; // expected-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
24 label
:; // expected-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
27 struct NonLiteral
{ // expected-note 2 {{'NonLiteral' is not literal}}
31 constexpr void non_literal() {
32 NonLiteral n
; // expected-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++23}}
35 constexpr void non_literal2(bool b
) {
37 NonLiteral n
; // expected-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++23}}
40 constexpr int c_thread_local(int n
) {
43 static _Thread_local
int a
; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
44 _Thread_local
int b
; // // expected-error {{'_Thread_local' variables must have global storage}}
48 constexpr int gnu_thread_local(int n
) {
51 static __thread
int a
; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
52 __thread
int b
; // expected-error {{'__thread' variables must have global storage}}