24 changes: 12 additions & 12 deletions clang/test/Parser/cxx2b-subscript.cpp
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx2b -std=c++2b %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx23 -std=c++23 %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx20 -std=c++20 %s

//cxx2b-no-diagnostics
//cxx23-no-diagnostics

struct S {
constexpr int operator[](int i) {
return i;
}
constexpr int operator[](int a, int b) { // cxx20-error {{overloaded 'operator[]' cannot have more than one parameter before C++2b}}
constexpr int operator[](int a, int b) { // cxx20-error {{overloaded 'operator[]' cannot have more than one parameter before C++23}}
return a + b;
}
constexpr int operator[]() { // cxx20-error {{overloaded 'operator[]' cannot have no parameter before C++2b}}
constexpr int operator[]() { // cxx20-error {{overloaded 'operator[]' cannot have no parameter before C++23}}
return 42;
}
};

struct Defaults {
constexpr int operator[](int i = 0) { // cxx20-error {{overloaded 'operator[]' cannot have a defaulted parameter before C++2b}}
constexpr int operator[](int i = 0) { // cxx20-error {{overloaded 'operator[]' cannot have a defaulted parameter before C++23}}
return 0;
}
constexpr int operator[](int a, int b, int c = 0) { // cxx20-error {{overloaded 'operator[]' cannot have a defaulted parameter before C++2b}}\
// cxx20-error {{cannot have more than one parameter before C++2b}}
constexpr int operator[](int a, int b, int c = 0) { // cxx20-error {{overloaded 'operator[]' cannot have a defaulted parameter before C++23}}\
// cxx20-error {{cannot have more than one parameter before C++23}}
return 0;
}
};

template <typename... T>
struct T1 {
constexpr auto operator[](T &&...arg); // cxx20-error {{overloaded 'operator[]' cannot have no parameter before C++2b}} \
// cxx20-error {{overloaded 'operator[]' cannot have more than one parameter before C++2b}}
constexpr auto operator[](T &&...arg); // cxx20-error {{overloaded 'operator[]' cannot have no parameter before C++23}} \
// cxx20-error {{overloaded 'operator[]' cannot have more than one parameter before C++23}}
};

T1<> t10; // cxx20-note {{requested here}}
Expand All @@ -43,16 +43,16 @@ void f() {
S s;
(void)s[0];
(void)s[1, 2]; // cxx20-warning {{left operand of comma operator has no effect}}\
// cxx20-warning {{top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++2b}}
// cxx20-warning {{top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++23}}
(void)S{}[]; // cxx20-error {{expected expression}}

(void)Defaults{}[1];
(void)Defaults{}[]; // cxx20-error {{expected expression}}
(void)Defaults{}[1, 2]; // cxx20-warning {{left operand of comma operator has no effect}}\
// cxx20-warning {{top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++2b}}
// cxx20-warning {{top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++23}}

Variadic{}[]; // cxx20-error {{expected expression}}
Variadic{}[1];
Variadic{}[1, 2]; // cxx20-warning {{left operand of comma operator has no effect}}\
// cxx20-warning {{top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++2b}}
// cxx20-warning {{top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++23}}
}
8 changes: 4 additions & 4 deletions clang/test/Parser/switch-recovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ void missing_statement_case(int x) {
switch (x) {
case 1:
case 0:
} // expected-warning {{label at end of compound statement is a C++2b extension}}
} // expected-warning {{label at end of compound statement is a C++23 extension}}
}

void missing_statement_default(int x) {
switch (x) {
case 0:
default:
} // expected-warning {{label at end of compound statement is a C++2b extension}}
} // expected-warning {{label at end of compound statement is a C++23 extension}}
}

void pr19022_1() {
Expand All @@ -179,7 +179,7 @@ void pr19022_1() {
void pr19022_1a(int x) {
switch(x) {
case 1 // expected-error{{expected ':' after 'case'}}
} // expected-warning {{label at end of compound statement is a C++2b extension}}
} // expected-warning {{label at end of compound statement is a C++23 extension}}
}

void pr19022_1b(int x) {
Expand Down Expand Up @@ -211,7 +211,7 @@ void pr19022_5(int x) {
switch(x) {
case 1: case // expected-error{{expected ':' after 'case'}}
} // expected-error{{expected expression}} \
// expected-warning {{label at end of compound statement is a C++2b extension}}
// expected-warning {{label at end of compound statement is a C++23 extension}}
}

namespace pr19022 {
Expand Down
32 changes: 16 additions & 16 deletions clang/test/Preprocessor/ext-pp-directive.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// RUN: not %clang_cc1 -std=c2x -fsyntax-only -verify %s

// For C++
// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=pre-cpp2b-pedantic -pedantic %s
// RUN: %clang_cc1 -x c++ -std=c++2b -fsyntax-only -verify=pre-cpp2b-compat -Wpre-c++2b-compat %s
// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=pre-cpp23-pedantic -pedantic %s
// RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify=pre-cpp23-compat -Wpre-c++23-compat %s
// RUN: not %clang_cc1 -x c++ -fsyntax-only -verify %s
// RUN: not %clang_cc1 -x c++ -std=c++2b -fsyntax-only -verify -pedantic %s
// RUN: not %clang_cc1 -x c++ -std=c++2b -fsyntax-only -verify %s
// RUN: not %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify -pedantic %s
// RUN: not %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify %s

int x;

Expand All @@ -22,8 +22,8 @@ int x;
// pre-c2x-compat-warning@#1 {{use of a '#elifdef' directive is incompatible with C standards before C2x}}

// For C++
// pre-cpp2b-pedantic-warning@#1 {{use of a '#elifdef' directive is a C++2b extension}}
// pre-cpp2b-compat-warning@#1 {{use of a '#elifdef' directive is incompatible with C++ standards before C++2b}}
// pre-cpp23-pedantic-warning@#1 {{use of a '#elifdef' directive is a C++23 extension}}
// pre-cpp23-compat-warning@#1 {{use of a '#elifdef' directive is incompatible with C++ standards before C++23}}

#if 1
#elifndef B // #2
Expand All @@ -33,8 +33,8 @@ int x;
// pre-c2x-compat-warning@#2 {{use of a '#elifndef' directive is incompatible with C standards before C2x}}

// For C++
// pre-cpp2b-pedantic-warning@#2 {{use of a '#elifndef' directive is a C++2b extension}}
// pre-cpp2b-compat-warning@#2 {{use of a '#elifndef' directive is incompatible with C++ standards before C++2b}}
// pre-cpp23-pedantic-warning@#2 {{use of a '#elifndef' directive is a C++23 extension}}
// pre-cpp23-compat-warning@#2 {{use of a '#elifndef' directive is incompatible with C++ standards before C++23}}

#if 0
#elifdef C
Expand All @@ -44,8 +44,8 @@ int x;
// pre-c2x-compat-warning@-4 {{use of a '#elifdef' directive is incompatible with C standards before C2x}}

// For C++
// pre-cpp2b-pedantic-warning@-7 {{use of a '#elifdef' directive is a C++2b extension}}
// pre-cpp2b-compat-warning@-8 {{use of a '#elifdef' directive is incompatible with C++ standards before C++2b}}
// pre-cpp23-pedantic-warning@-7 {{use of a '#elifdef' directive is a C++23 extension}}
// pre-cpp23-compat-warning@-8 {{use of a '#elifdef' directive is incompatible with C++ standards before C++23}}

#if 0
#elifndef D
Expand All @@ -55,8 +55,8 @@ int x;
// pre-c2x-compat-warning@-4 {{use of a '#elifndef' directive is incompatible with C standards before C2x}}

// For C++
// pre-cpp2b-pedantic-warning@-7 {{use of a '#elifndef' directive is a C++2b extension}}
// pre-cpp2b-compat-warning@-8 {{use of a '#elifndef' directive is incompatible with C++ standards before C++2b}}
// pre-cpp23-pedantic-warning@-7 {{use of a '#elifndef' directive is a C++23 extension}}
// pre-cpp23-compat-warning@-8 {{use of a '#elifndef' directive is incompatible with C++ standards before C++23}}

#warning foo
// For C
Expand All @@ -66,7 +66,7 @@ int x;
// pre-c2x-compat-warning@-5 {{foo}}

// For C++
// pre-cpp2b-pedantic-warning@-8 {{#warning is a C++2b extension}}
// pre-cpp2b-pedantic-warning@-9 {{foo}}
// pre-cpp2b-compat-warning@-10 {{#warning is incompatible with C++ standards before C++2b}}
// pre-cpp2b-compat-warning@-11 {{foo}}
// pre-cpp23-pedantic-warning@-8 {{#warning is a C++23 extension}}
// pre-cpp23-pedantic-warning@-9 {{foo}}
// pre-cpp23-compat-warning@-10 {{#warning is incompatible with C++ standards before C++23}}
// pre-cpp23-compat-warning@-11 {{foo}}
4 changes: 2 additions & 2 deletions clang/test/Preprocessor/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// BLOCKS:#define __block __attribute__((__blocks__(byref)))
//
//
// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++2b -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix CXX2B %s
// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++23 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix CXX2B %s
//
// CXX2B:#define __GNUG__ 4
// CXX2B:#define __GXX_EXPERIMENTAL_CXX0X__ 1
Expand Down Expand Up @@ -133,7 +133,7 @@
// RUN: %clang_cc1 -ffreestanding -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix FREESTANDING %s
// FREESTANDING:#define __STDC_HOSTED__ 0
//
// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=gnu++2b -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GXX2B %s
// RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=gnu++23 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GXX2B %s
//
// GXX2B:#define __GNUG__ 4
// GXX2B:#define __GXX_WEAK__ 1
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Preprocessor/macro_vaopt_check.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -Wno-c++2b-extensions -pedantic -std=c++20
// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -Wno-c++2b-extensions -pedantic -std=c++11
// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -Wno-c++23-extensions -pedantic -std=c++20
// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -Wno-c++23-extensions -pedantic -std=c++11
// RUN: %clang_cc1 -x c %s -Eonly -verify -Wno-all -Wno-c2x-extensions -pedantic -std=c99

//expected-error@+1{{missing '('}}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Preprocessor/predefined-win-macros.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
// CHECK-MS-CPP20: #define _MSVC_LANG 202002L

// RUN: %clang_cc1 %s -x c++ -E -dM -triple i686-pc-win32 -fms-extensions -fms-compatibility \
// RUN: -fms-compatibility-version=19.00 -std=c++2b -o - | FileCheck -match-full-lines %s --check-prefix=CHECK-MS-CPP2B
// RUN: -fms-compatibility-version=19.00 -std=c++23 -o - | FileCheck -match-full-lines %s --check-prefix=CHECK-MS-CPP2B
// CHECK-MS-CPP2B: #define _MSC_VER 1900
// CHECK-MS-CPP2B: #define _MSVC_LANG 202004L

Expand Down
46 changes: 23 additions & 23 deletions clang/test/Preprocessor/suggest-typoed-directive.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// RUN: %clang_cc1 -fsyntax-only -verify=pre-c2x-cpp2b %s
// RUN: %clang_cc1 -std=c2x -fsyntax-only -verify=c2x-cpp2b %s
// RUN: %clang_cc1 -x c++ -std=c++2b -fsyntax-only -verify=c2x-cpp2b %s
// RUN: %clang_cc1 -x c++ -std=c++2b -fsyntax-only %s -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
// RUN: %clang_cc1 -fsyntax-only -verify=pre-c2x-cpp23 %s
// RUN: %clang_cc1 -std=c2x -fsyntax-only -verify=c2x-cpp23 %s
// RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify=c2x-cpp23 %s
// RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only %s -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s

// id: pre-c2x-cpp2b-warning@+12 {{invalid preprocessing directive, did you mean '#if'?}}
// ifd: pre-c2x-cpp2b-warning@+12 {{invalid preprocessing directive, did you mean '#if'?}}
// ifde: pre-c2x-cpp2b-warning@+12 {{invalid preprocessing directive, did you mean '#ifdef'?}}
// elf: pre-c2x-cpp2b-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elsif: pre-c2x-cpp2b-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elseif: pre-c2x-cpp2b-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
// id: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#if'?}}
// ifd: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#if'?}}
// ifde: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#ifdef'?}}
// elf: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elsif: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elseif: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elfidef: not suggested to '#elifdef'
// elfindef: not suggested to '#elifdef'
// elfinndef: not suggested to '#elifndef'
// els: pre-c2x-cpp2b-warning@+12 {{invalid preprocessing directive, did you mean '#else'?}}
// endi: pre-c2x-cpp2b-warning@+12 {{invalid preprocessing directive, did you mean '#endif'?}}
// els: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#else'?}}
// endi: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#endif'?}}
#ifdef UNDEFINED
#id
#ifd
Expand All @@ -27,17 +27,17 @@
#els
#endi
#endif
// id: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#if'?}}
// ifd: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#if'?}}
// ifde: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#ifdef'?}}
// elf: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elsif: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elseif: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elfidef: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}}
// elfindef: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}}
// elfinndef: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#elifndef'?}}
// els: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#else'?}}
// endi: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#endif'?}}
// id: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#if'?}}
// ifd: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#if'?}}
// ifde: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#ifdef'?}}
// elf: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elsif: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elseif: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
// elfidef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}}
// elfindef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}}
// elfinndef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifndef'?}}
// els: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#else'?}}
// endi: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#endif'?}}

// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:4}:"if"
// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:5}:"if"
Expand Down
14 changes: 7 additions & 7 deletions clang/test/Preprocessor/ucn-pp-identifier.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -fsyntax-only -std=c99 -pedantic -verify=expected,ext -Wundef -DTRIGRAPHS=1
// RUN: %clang_cc1 %s -fsyntax-only -x c++ -pedantic -verify=expected,ext -Wundef -fno-trigraphs
// RUN: %clang_cc1 %s -fsyntax-only -x c++ -std=c++2b -pedantic -ftrigraphs -DTRIGRAPHS=1 -verify=expected,cxx2b -Wundef -Wpre-c++2b-compat
// RUN: %clang_cc1 %s -fsyntax-only -x c++ -std=c++23 -pedantic -ftrigraphs -DTRIGRAPHS=1 -verify=expected,cxx23 -Wundef -Wpre-c++23-compat
// RUN: %clang_cc1 %s -fsyntax-only -x c++ -pedantic -verify=expected,ext -Wundef -ftrigraphs -DTRIGRAPHS=1
// RUN: not %clang_cc1 %s -fsyntax-only -std=c99 -pedantic -Wundef 2>&1 | FileCheck -strict-whitespace %s

Expand All @@ -18,7 +18,7 @@
#error "This should never happen"
#endif

#if a\u{FD}() // ext-warning {{extension}} cxx2b-warning {{before C++2b}}
#if a\u{FD}() // ext-warning {{extension}} cxx23-warning {{before C++23}}
#error "This should never happen"
#endif

Expand All @@ -34,12 +34,12 @@
#define \U10000000 // expected-error {{macro name must be an identifier}}
#define \u0061 // expected-error {{character 'a' cannot be specified by a universal character name}} expected-error {{macro name must be an identifier}}
#define \u{fffe} // expected-error {{macro name must be an identifier}} \
// ext-warning {{extension}} cxx2b-warning {{before C++2b}}
// ext-warning {{extension}} cxx23-warning {{before C++23}}
#define \N{ALERT} // expected-error {{universal character name refers to a control character}} \
// expected-error {{macro name must be an identifier}} \
// ext-warning {{extension}} cxx2b-warning {{before C++2b}}
// ext-warning {{extension}} cxx23-warning {{before C++23}}
#define \N{WASTEBASKET} // expected-error {{macro name must be an identifier}} \
// ext-warning {{extension}} cxx2b-warning {{before C++2b}}
// ext-warning {{extension}} cxx23-warning {{before C++23}}
#define a\u0024

#if \u0110 // expected-warning {{is not defined, evaluates to 0}}
Expand Down Expand Up @@ -141,10 +141,10 @@ int CONCAT(\N{GREEK

int \N{\
LATIN CAPITAL LETTER A WITH GRAVE};
//ext-warning@-2 {{extension}} cxx2b-warning@-2 {{before C++2b}}
//ext-warning@-2 {{extension}} cxx23-warning@-2 {{before C++23}}

#ifdef TRIGRAPHS
int \N??<GREEK CAPITAL LETTER ALPHA??> = 0; // cxx2b-warning {{before C++2b}} \
int \N??<GREEK CAPITAL LETTER ALPHA??> = 0; // cxx23-warning {{before C++23}} \
//ext-warning {{extension}}\
// expected-warning 2{{trigraph converted}}

Expand Down
4 changes: 2 additions & 2 deletions clang/test/Sema/gnu-asm-pmf.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++2b -fsyntax-only %s -verify
// RUN: %clang_cc1 -triple x86_64-unknown-windows-itanium -std=c++2b -fsyntax-only %s -verify
// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++23 -fsyntax-only %s -verify
// RUN: %clang_cc1 -triple x86_64-unknown-windows-itanium -std=c++23 -fsyntax-only %s -verify

struct S {
void operator()();
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Sema/stmtexpr-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void T1(void) {
int *x[1] = {({ static int _x = 10; &_x; })}; // expected-no-error

/* Before commit
683e83c5 [Clang][C++2b] P2242R3: Non-literal variables [...] in constexpr
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.
*/
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/P1155.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -fcxx-exceptions -verify %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fcxx-exceptions -verify %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
// expected-no-diagnostics
Expand Down
26 changes: 13 additions & 13 deletions clang/test/SemaCXX/constant-expression-cxx11.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx20_2b,cxx2b -triple x86_64-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -Wno-c99-designator -fcxx-exceptions -pedantic %s -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx11_20,cxx20_2b -triple x86_64-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -Wno-c99-designator -fcxx-exceptions -pedantic %s -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 -triple x86_64-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -Wno-c99-designator -fcxx-exceptions -pedantic %s -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx11_20,cxx20_23 -triple x86_64-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -Wno-c99-designator -fcxx-exceptions -pedantic %s -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11_20,cxx11 -triple x86_64-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -Wno-c99-designator -fcxx-exceptions -pedantic %s -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion

namespace StaticAssertFoldTest {

int x;
static_assert(++x, "test"); // expected-error {{not an integral constant expression}}
// cxx20_2b-note@-1 {{cannot modify an object that is visible outside that expression}}
// cxx20_23-note@-1 {{cannot modify an object that is visible outside that expression}}
static_assert(false, "test"); // expected-error {{test}}

}
Expand Down Expand Up @@ -360,7 +360,7 @@ extern char externalvar[];
constexpr bool constaddress = (void *)externalvar == (void *)0x4000UL; // expected-error {{must be initialized by a constant expression}} expected-note {{reinterpret_cast}}
constexpr bool litaddress = "foo" == "foo"; // expected-error {{must be initialized by a constant expression}}
// expected-note@-1 {{comparison of addresses of literals has unspecified value}}
// cxx20_2b-warning@-2 {{comparison between two arrays is deprecated}}
// cxx20_23-warning@-2 {{comparison between two arrays is deprecated}}
static_assert(0 != "foo", "");

}
Expand Down Expand Up @@ -1777,12 +1777,12 @@ namespace std { struct type_info; }
namespace TypeId {
struct A { virtual ~A(); };
A f();
A &g(); // cxx20_2b-note {{declared here}}
A &g(); // cxx20_23-note {{declared here}}
constexpr auto &x = typeid(f());
constexpr auto &y = typeid(g()); // expected-error{{constant expression}}
// cxx11-note@-1 {{typeid applied to expression of polymorphic type 'A' is not allowed in a constant expression}}
// expected-warning@-2 {{expression with side effects will be evaluated despite being used as an operand to 'typeid'}}
// cxx20_2b-note@-3 {{non-constexpr function 'g' cannot be used in a constant expression}}
// cxx20_23-note@-3 {{non-constexpr function 'g' cannot be used in a constant expression}}
}

namespace PR14203 {
Expand Down Expand Up @@ -1921,14 +1921,14 @@ namespace VirtualFromBase {
static_assert(p->f() == sizeof(X<S1>), "");
// cxx11-error@-1 {{not an integral constant expression}}
// cxx11-note@-2 {{call to virtual function}}
// cxx20_2b-error@-3 {{static assertion failed}}
// cxx20_2b-note@-4 {{8 == 16}}
// cxx20_23-error@-3 {{static assertion failed}}
// cxx20_23-note@-4 {{8 == 16}}

// Non-virtual f(), OK.
constexpr X<X<S2>> xxs2;
constexpr X<S2> *q = const_cast<X<X<S2>>*>(&xxs2);
static_assert(q->f() == sizeof(S2), ""); // cxx20_2b-error {{static assertion failed}} \
// cxx20_2b-note {{16 == 8}}
static_assert(q->f() == sizeof(S2), ""); // cxx20_23-error {{static assertion failed}} \
// cxx20_23-note {{16 == 8}}
}

namespace ConstexprConstructorRecovery {
Expand All @@ -1954,7 +1954,7 @@ namespace Lifetime {
}

constexpr int &get(int &&n) { return n; }
// cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
// cxx23-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
constexpr int &&get_rv(int &&n) { return static_cast<int&&>(n); }
struct S {
int &&r;
Expand Down Expand Up @@ -2281,13 +2281,13 @@ namespace InheritedCtor {
constexpr D d(0); // cxx11-error {{constant expression}} cxx11-note {{derived class}}

struct E : virtual A { using A::A; }; // expected-note {{here}}
// cxx20_2b-note@-1 {{struct with virtual base class is not a literal type}}
// cxx20_23-note@-1 {{struct with virtual base class is not a literal type}}
// We wrap a function around this to avoid implicit zero-initialization
// happening first; the zero-initialization step would produce the same
// error and defeat the point of this test.
void f() {
constexpr E e(0); // cxx11-error {{constant expression}} cxx11-note {{derived class}}
// cxx20_2b-error@-1 {{constexpr variable cannot have non-literal type}}
// cxx20_23-error@-1 {{constexpr variable cannot have non-literal type}}
}
// FIXME: This produces a note with no source location.
//constexpr E e(0);
Expand Down
20 changes: 10 additions & 10 deletions clang/test/SemaCXX/constant-expression-cxx14.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx20_2b,cxx2b %s -fcxx-exceptions -triple=x86_64-linux-gnu
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_2b,cxx20 %s -fcxx-exceptions -triple=x86_64-linux-gnu
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 %s -fcxx-exceptions -triple=x86_64-linux-gnu
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_23,cxx20 %s -fcxx-exceptions -triple=x86_64-linux-gnu
// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=expected,cxx14_20,cxx14 %s -fcxx-exceptions -triple=x86_64-linux-gnu

struct S {
Expand Down Expand Up @@ -46,12 +46,12 @@ constexpr int g(int k) {
static_assert(g(2) == 42, "");
constexpr int h(int n) { // expected-error {{constexpr function never produces a constant expression}}
static const int m = n; // expected-note {{control flows through the definition of a static variable}} \
// cxx14_20-warning {{definition of a static variable in a constexpr function is a C++2b extension}}
// cxx14_20-warning {{definition of a static variable in a constexpr function is a C++23 extension}}
return m;
}
constexpr int i(int n) { // expected-error {{constexpr function never produces a constant expression}}
thread_local const int m = n; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx14_20-warning {{definition of a thread_local variable in a constexpr function is a C++2b extension}}
// cxx14_20-warning {{definition of a thread_local variable in a constexpr function is a C++23 extension}}
return m;
}

Expand Down Expand Up @@ -229,7 +229,7 @@ namespace subobject {
// expected-note@-2 {{assignment to member 'c' of union with active member 'n'}}
}
constexpr bool check(D &d) { return d.c.a.y == 3; }
// cxx20_2b-note@-1 {{read of member 'y' of union with active member 'x'}}
// cxx20_23-note@-1 {{read of member 'y' of union with active member 'x'}}

constexpr bool g() { D d; f(d); return d.c.a.y == 3; }
static_assert(g(), "");
Expand All @@ -242,7 +242,7 @@ namespace subobject {
static_assert(i(), ""); // expected-error {{constant expression}} expected-note {{in call}}

constexpr bool j() { D d; d.c.a.x = 3; return check(d); } // cxx14-note {{assignment to member 'x' of union with active member 'y'}}
// cxx20_2b-note@-1 {{in call to 'check(d)'}}
// cxx20_23-note@-1 {{in call to 'check(d)'}}
static_assert(j(), ""); // expected-error {{constant expression}} expected-note {{in call}}
}

Expand Down Expand Up @@ -271,12 +271,12 @@ namespace null {

namespace incdec {
template<typename T> constexpr T &ref(T &&r) { return r; }
// cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
// cxx23-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
template<typename T> constexpr T postinc(T &&r) { return (r++, r); }
template<typename T> constexpr T postdec(T &&r) { return (r--, r); }

template int &ref<int>(int &&);
// cxx2b-note@-1 {{in instantiation of function template specialization}}
// cxx23-note@-1 {{in instantiation of function template specialization}}

static_assert(postinc(0) == 1, "");
static_assert(postdec(0) == -1, "");
Expand Down Expand Up @@ -345,7 +345,7 @@ namespace incdec {
}
constexpr int wrong_member = f({0}); // expected-error {{constant}} expected-note {{in call to 'f({.a = 0})'}}
constexpr int vol = --ref<volatile int>(0); // expected-error {{constant}} expected-note {{decrement of volatile-qualified}}
// cxx20_2b-warning@-1 {{decrement of object of volatile-qualified type 'volatile int' is deprecated}}
// cxx20_23-warning@-1 {{decrement of object of volatile-qualified type 'volatile int' is deprecated}}

constexpr int incr(int k) {
int x = k;
Expand Down Expand Up @@ -877,7 +877,7 @@ namespace VirtualFromBase {

namespace Lifetime {
constexpr int &get(int &&r) { return r; }
// cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
// cxx23-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
constexpr int f() {
int &r = get(123);
return r;
Expand Down
76 changes: 38 additions & 38 deletions clang/test/SemaCXX/constant-expression-cxx2b.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx2a %s -fcxx-exceptions -triple=x86_64-linux-gnu -Wno-c++2b-extensions
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx2b %s -fcxx-exceptions -triple=x86_64-linux-gnu -Wpre-c++2b-compat
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx2a %s -fcxx-exceptions -triple=x86_64-linux-gnu -Wno-c++23-extensions
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx23 %s -fcxx-exceptions -triple=x86_64-linux-gnu -Wpre-c++23-compat

struct NonLiteral { // cxx2a-note {{'NonLiteral' is not literal}} \
// cxx2b-note 2{{'NonLiteral' is not literal}}
// cxx23-note 2{{'NonLiteral' is not literal}}
NonLiteral() {}
};

Expand All @@ -12,50 +12,50 @@ struct Constexpr{};

constexpr int f(int n) { // expected-error {{constexpr function never produces a constant expression}}
static const int m = n; // expected-note {{control flows through the definition of a static variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexpr int g(int n) { // expected-error {{constexpr function never produces a constant expression}}
thread_local const int m = n; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}

constexpr int c_thread_local(int n) { // expected-error {{constexpr function never produces a constant expression}}
static _Thread_local int m = 0; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}

constexpr int gnu_thread_local(int n) { // expected-error {{constexpr function never produces a constant expression}}
static __thread int m = 0; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}

constexpr int h(int n) { // expected-error {{constexpr function never produces a constant expression}}
static const int m = n; // expected-note {{control flows through the definition of a static variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return &m - &m;
}
constexpr int i(int n) { // expected-error {{constexpr function never produces a constant expression}}
thread_local const int m = n; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
return &m - &m;
}

constexpr int j(int n) {
if (!n)
return 0;
static const int m = n; // cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
static const int m = n; // cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexpr int j0 = j(0);

constexpr int k(int n) {
if (!n)
return 0;
thread_local const int m = n; // cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
thread_local const int m = n; // cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}

return m;
}
Expand All @@ -65,7 +65,7 @@ constexpr int j_evaluated(int n) {
if (!n)
return 0;
static const int m = n; // expected-note {{control flows through the definition of a static variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}

Expand All @@ -76,7 +76,7 @@ constexpr int k_evaluated(int n) {
if (!n)
return 0;
thread_local const int m = n; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}

return m;
}
Expand All @@ -85,21 +85,21 @@ constexpr int ke = k_evaluated(1); // expected-error {{constexpr variable 'ke' m
// expected-note {{in call}}

constexpr int static_constexpr() {
static constexpr int m = 42; // cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
static constexpr Constexpr foo; // cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
static constexpr int m = 42; // cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
static constexpr Constexpr foo; // cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}

constexpr int thread_local_constexpr() {
thread_local constexpr int m = 42; // cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
thread_local constexpr Constexpr foo; // cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
thread_local constexpr int m = 42; // cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
thread_local constexpr Constexpr foo; // cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}

constexpr int non_literal(bool b) {
if (!b)
return 0;
NonLiteral n; // cxx2b-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++2b}}
NonLiteral n; // cxx23-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++23}}
}

constexpr int non_literal_1 = non_literal(false);
Expand All @@ -111,7 +111,7 @@ constexpr int f(int x) {
return 0;
} else {
goto test; // expected-note {{subexpression not valid in a constant expression}} \
// cxx2b-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
}
test:
return 0;
Expand All @@ -124,7 +124,7 @@ constexpr int c = f(1);

constexpr int label() {

test: // cxx2b-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++2b}}
test: // cxx23-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
return 0;
}

Expand All @@ -138,14 +138,14 @@ constexpr int d = label();
// This is to be contrasted with the test for implicitly constexpr lambdas below.
int test_in_lambdas() {
auto a = []() constexpr {
static const int m = 32; // cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
static const int m = 32; // cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
};

auto b = [](int n) constexpr {
if (!n)
return 0;
static const int m = n; // cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
static const int m = n; // cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
(1);
Expand All @@ -155,7 +155,7 @@ int test_in_lambdas() {
return 0;
else
goto test; // expected-note {{subexpression not valid in a constant expression}} \
// cxx2b-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
test:
return 1;
};
Expand All @@ -165,15 +165,15 @@ int test_in_lambdas() {

auto non_literal = [](bool b) constexpr {
if (!b)
NonLiteral n; // cxx2b-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}} \
// cxx2a-error {{variable of non-literal type 'NonLiteral' cannot be defined in a constexpr function before C++2b}} \
// cxx2b-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++2b}}
NonLiteral n; // cxx23-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}} \
// cxx2a-error {{variable of non-literal type 'NonLiteral' cannot be defined in a constexpr function before C++23}} \
// cxx23-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++23}}
return 0;
};

#if __cplusplus > 202002L
constexpr auto non_literal_ko = non_literal(false); // cxx2b-error {{constexpr variable 'non_literal_ko' must be initialized by a constant expression}} \
// cxx2b-note {{in call}}
constexpr auto non_literal_ko = non_literal(false); // cxx23-error {{constexpr variable 'non_literal_ko' must be initialized by a constant expression}} \
// cxx23-note {{in call}}

constexpr auto non_literal_ok = non_literal(true);
#endif
Expand All @@ -187,7 +187,7 @@ int test_lambdas_implicitly_constexpr() {
auto b = [](int n) { // cxx2a-note 2{{declared here}}
if (!n)
return 0;
static const int m = n; // cxx2b-note {{control flows through the definition of a static variable}}
static const int m = n; // cxx23-note {{control flows through the definition of a static variable}}
return m;
};

Expand All @@ -197,13 +197,13 @@ int test_lambdas_implicitly_constexpr() {

constexpr auto b3 = b(1); // expected-error{{constexpr variable 'b3' must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}} \
// cxx2b-note {{in call}}
// cxx23-note {{in call}}

auto c = [](int n) { // cxx2a-note 2{{declared here}}
if (!n)
return 0;
else
goto test; // cxx2b-note {{subexpression not valid in a constant expression}}
goto test; // cxx23-note {{subexpression not valid in a constant expression}}
test:
return 1;
};
Expand All @@ -213,17 +213,17 @@ int test_lambdas_implicitly_constexpr() {

constexpr auto c_error = c(1); // expected-error {{constexpr variable 'c_error' must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}} \
// cxx2b-note {{in call to}}
// cxx23-note {{in call to}}

auto non_literal = [](bool b) { // cxx2a-note 2{{declared here}}
if (b)
NonLiteral n; // cxx2b-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}}
NonLiteral n; // cxx23-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}}
return 0;
};

constexpr auto non_literal_ko = non_literal(true); // expected-error {{constexpr variable 'non_literal_ko' must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}} \
// cxx2b-note {{in call}}
// cxx23-note {{in call}}

constexpr auto non_literal_ok = non_literal(false); // cxx2a-error {{must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}}
Expand All @@ -238,8 +238,8 @@ constexpr auto dependent_var_def_lambda() {
};
}

constexpr auto non_literal_valid_in_cxx2b = dependent_var_def_lambda<NonLiteral>()(true); // \
// cxx2a-error {{constexpr variable 'non_literal_valid_in_cxx2b' must be initialized by a constant expression}} \
constexpr auto non_literal_valid_in_cxx23 = dependent_var_def_lambda<NonLiteral>()(true); // \
// cxx2a-error {{constexpr variable 'non_literal_valid_in_cxx23' must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}}


Expand All @@ -249,8 +249,8 @@ constexpr double evaluate_static_constexpr() {
return 42;
}
};
thread_local constexpr Constexpr t; // cxx2b-warning {{before C++2b}}
static constexpr Constexpr s; // cxx2b-warning {{before C++2b}}
thread_local constexpr Constexpr t; // cxx23-warning {{before C++23}}
static constexpr Constexpr s; // cxx23-warning {{before C++23}}
return t.f() + s.f();
}
static_assert(evaluate_static_constexpr() == 84);
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/conversion-function.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected -triple %itanium_abi_triple -Wbind-to-temporary-copy %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected -triple %itanium_abi_triple -Wbind-to-temporary-copy %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -triple %itanium_abi_triple -Wbind-to-temporary-copy %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx98_11,cxx11 -triple %itanium_abi_triple -Wbind-to-temporary-copy %s
// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify=expected,cxx98_11,cxx98 -triple %itanium_abi_triple -Wbind-to-temporary-copy %s
Expand Down
14 changes: 7 additions & 7 deletions clang/test/SemaCXX/coroutines.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// This file contains references to sections of the Coroutines TS, which can be
// found at http://wg21.link/coroutines.

// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx20_2b,cxx2b %s -fcxx-exceptions -fexceptions -Wunused-result
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_2b %s -fcxx-exceptions -fexceptions -Wunused-result
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 %s -fcxx-exceptions -fexceptions -Wunused-result
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_23 %s -fcxx-exceptions -fexceptions -Wunused-result

void no_coroutine_traits_bad_arg_await() {
co_await a; // expected-error {{include <coroutine>}}
Expand Down Expand Up @@ -933,7 +933,7 @@ struct std::coroutine_traits<int, mismatch_gro_type_tag2> {
};

extern "C" int f(mismatch_gro_type_tag2) {
// cxx2b-error@-1 {{cannot initialize return object of type 'int' with an rvalue of type 'void *'}}
// cxx23-error@-1 {{cannot initialize return object of type 'int' with an rvalue of type 'void *'}}
// cxx14_20-error@-2 {{cannot initialize return object of type 'int' with an lvalue of type 'void *'}}
co_return; //expected-note {{function is a coroutine due to use of 'co_return' here}}
}
Expand Down Expand Up @@ -1031,7 +1031,7 @@ struct await_suspend_type_test {
// expected-error@+2 {{return type of 'await_suspend' is required to be 'void' or 'bool' (have 'bool &')}}
// expected-error@+1 {{return type of 'await_suspend' is required to be 'void' or 'bool' (have 'bool &&')}}
SuspendTy await_suspend(std::coroutine_handle<>);
// cxx20_2b-warning@-1 {{volatile-qualified return type 'const volatile bool' is deprecated}}
// cxx20_23-warning@-1 {{volatile-qualified return type 'const volatile bool' is deprecated}}
void await_resume();
};
void test_bad_suspend() {
Expand All @@ -1053,7 +1053,7 @@ void test_bad_suspend() {
await_suspend_type_test<bool &&> a;
await_suspend_type_test<bool &> b;
await_suspend_type_test<const void> c;
await_suspend_type_test<const volatile bool> d; // cxx20_2b-note {{in instantiation of template class}}
await_suspend_type_test<const volatile bool> d; // cxx20_23-note {{in instantiation of template class}}
co_await a; // expected-note {{call to 'await_suspend' implicitly required by coroutine function here}}
co_await b; // expected-note {{call to 'await_suspend' implicitly required by coroutine function here}}
co_await c; // OK
Expand Down Expand Up @@ -1141,7 +1141,7 @@ struct TestType {
}

CoroMemberTag test_qual(int *, const float &&, volatile void *volatile) const {
// cxx20_2b-warning@-1 {{volatile-qualified parameter type}}
// cxx20_23-warning@-1 {{volatile-qualified parameter type}}
auto TC = co_yield 0;
static_assert(TC.MatchesArgs<const TestType &, int *, const float &&, volatile void *volatile>, "");
}
Expand Down Expand Up @@ -1240,7 +1240,7 @@ struct DepTestType {
}

CoroMemberTag test_qual(int *, const float &&, volatile void *volatile) const {
// cxx20_2b-warning@-1 {{volatile-qualified parameter type}}
// cxx20_23-warning@-1 {{volatile-qualified parameter type}}
auto TC = co_yield 0;
static_assert(TC.template MatchesArgs<const DepTestType &, int *, const float &&, volatile void *volatile>, "");
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/cxx2a-consteval-default-params.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2b %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++23 %s

consteval int undefined(); // expected-note 4 {{declared here}}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/cxx2b-ast-print.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -ast-print %s | FileCheck %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -ast-print %s | FileCheck %s

template <template <class...> class C>
void test_auto_expr(long long y, auto &&z) {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/cxx2b-consteval-if.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -verify %s
// RUN: %clang_cc1 -std=c++23 -verify %s

namespace PR52206 {
constexpr auto f() {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/cxx2b-designated-initializers.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s

namespace PR61118 {

Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/cxx2b-init-statement.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -std=c++2b -Wall -Wshadow %s
// RUN: %clang_cc1 -verify -std=c++23 -Wall -Wshadow %s

void f() {

Expand Down
6 changes: 3 additions & 3 deletions clang/test/SemaCXX/cxx2b-overloaded-operator-pedantic.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// RUN: %clang_cc1 -verify -std=c++2b -pedantic %s
// RUN: %clang_cc1 -verify=compat -std=c++2b -Wpre-c++2b-compat %s
// RUN: %clang_cc1 -verify -std=c++23 -pedantic %s
// RUN: %clang_cc1 -verify=compat -std=c++23 -Wpre-c++23-compat %s

// expected-no-diagnostics

struct GH61582 {
// We accidentally would issue this diagnostic in pedantic mode; show that we
// only issue it when enabling the compat warnings now.
void operator[](int, int); // compat-warning {{overloaded 'operator[]' with more than one parameter is a C++2b extension}}
void operator[](int, int); // compat-warning {{overloaded 'operator[]' with more than one parameter is a C++23 extension}}
};

2 changes: 1 addition & 1 deletion clang/test/SemaCXX/cxx2b-overloaded-operator.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -std=c++2b %s
// RUN: %clang_cc1 -verify -std=c++23 %s

namespace N {

Expand Down
40 changes: 20 additions & 20 deletions clang/test/SemaCXX/cxx2b-p2266-disable-with-msvc-compat.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx2b,new %s
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -fms-compatibility -verify=cxx2b,old %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=cxx23,new %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fms-compatibility -verify=cxx23,old %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20,old %s

// FIXME: This is a test for a temporary workaround where we disable simpler implicit moves
Expand All @@ -18,40 +18,40 @@ struct nocopy {
};

int &&mt1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &mt2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &mt2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy mt3(nocopy x) { return x; }

namespace {
int &&mt1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &mt2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &mt2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy mt3(nocopy x) { return x; }
} // namespace

namespace foo {
int &&mt1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &mt2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &mt2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
namespace std {
int &&mt1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &mt2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &mt2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy mt3(nocopy x) { return x; }
} // namespace std
} // namespace foo

namespace std {

int &&mt1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &mt2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &mt2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy mt3(nocopy x) { return x; }

namespace {
int &&mt1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &mt2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &mt2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy mt3(nocopy x) { return x; }
} // namespace

namespace foo {
int &&mt1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &mt2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &mt2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy mt3(nocopy x) { return x; }
} // namespace foo

Expand All @@ -65,41 +65,41 @@ nocopy mt3(nocopy x) { return x; }
#elif !defined(SYSTEM)

int &&ut1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &ut2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &ut2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy ut3(nocopy x) { return x; }

namespace {
int &&ut1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &ut2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &ut2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy ut3(nocopy x) { return x; }
} // namespace

namespace foo {
int &&ut1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &ut2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &ut2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy ut3(nocopy x) { return x; }
namespace std {
int &&ut1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &ut2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &ut2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy ut3(nocopy x) { return x; }
} // namespace std
} // namespace foo

namespace std {

int &&ut1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &ut2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &ut2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy ut3(nocopy x) { return x; }

namespace {
int &&ut1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &ut2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &ut2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy ut3(nocopy x) { return x; }
} // namespace

namespace foo {
int &&ut1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &ut2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &ut2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy ut3(nocopy x) { return x; }
} // namespace foo

Expand All @@ -110,22 +110,22 @@ nocopy ut3(nocopy x) { return x; }
#pragma GCC system_header

int &&st1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &st2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &st2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy st3(nocopy x) { return x; }

namespace {
int &&st1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &st2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &st2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy st3(nocopy x) { return x; }
} // namespace

namespace foo {
int &&st1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &st2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &st2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy st3(nocopy x) { return x; }
namespace std {
int &&st1(int &&x) { return x; } // cxx20-error {{cannot bind to lvalue}}
int &st2(int &&x) { return x; } // cxx2b-error {{cannot bind to a temporary}}
int &st2(int &&x) { return x; } // cxx23-error {{cannot bind to a temporary}}
nocopy st3(nocopy x) { return x; }
} // namespace std
} // namespace foo
Expand Down
22 changes: 11 additions & 11 deletions clang/test/SemaCXX/deduced-return-type-cxx14.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx20_2b,cxx2b %s
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx20_2b,cxx2b %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING

// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_2b %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_2b %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_23 %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_23 %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING

// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=expected,cxx14_20,cxx14 %s
// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=expected,cxx14_20,cxx14 %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING
Expand Down Expand Up @@ -129,14 +129,14 @@ namespace Templates {
return T() + 1;
}
template<typename T> auto &f2(T &&v) { return v; }
// cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
// cxx2b-error@-2 {{non-const lvalue reference to type 'double' cannot bind to a temporary of type 'double'}}
// cxx2b-note@-3 {{candidate template ignored: substitution failure [with T = double]}}
// cxx23-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
// cxx23-error@-2 {{non-const lvalue reference to type 'double' cannot bind to a temporary of type 'double'}}
// cxx23-note@-3 {{candidate template ignored: substitution failure [with T = double]}}
int a = f1<int>();
const int &b = f2(0); // cxx2b-note {{in instantiation of function template specialization 'Templates::f2<int>' requested here}}
const int &b = f2(0); // cxx23-note {{in instantiation of function template specialization 'Templates::f2<int>' requested here}}
double d;
float &c = f2(0.0); // expected-error {{non-const lvalue reference to type 'float' cannot bind to a value of unrelated type 'double'}}
// cxx2b-note@-1 {{in instantiation of function template specialization 'Templates::f2<double>' requested here}}
// cxx23-note@-1 {{in instantiation of function template specialization 'Templates::f2<double>' requested here}}

template<typename T> auto fwd_decl(); // expected-note {{declared here}}
int e = fwd_decl<int>(); // expected-error {{cannot be used before it is defined}}
Expand All @@ -150,7 +150,7 @@ namespace Templates {
auto (*q)() = f1<int>; // ok

typedef decltype(f2(1.2)) dbl; // cxx14_20-note {{previous}}
// cxx2b-error@-1 {{no matching function for call to 'f2'}}
// cxx23-error@-1 {{no matching function for call to 'f2'}}
typedef float dbl; // cxx14_20-error {{typedef redefinition with different types ('float' vs 'decltype(f2(1.2))' (aka 'double &'))}}

extern template auto fwd_decl<double>();
Expand Down Expand Up @@ -299,7 +299,7 @@ namespace Constexpr {
constexpr int q = Y<int>().f(); // expected-error {{must be initialized by a constant expression}} expected-note {{in call to '&Y<int>()->f()'}}
}
struct NonLiteral { ~NonLiteral(); } nl; // cxx14-note {{user-provided destructor}}
// cxx20_2b-note@-1 {{'NonLiteral' is not literal because its destructor is not constexpr}}
// cxx20_23-note@-1 {{'NonLiteral' is not literal because its destructor is not constexpr}}
constexpr auto f2(int n) { return nl; } // expected-error {{return type 'struct NonLiteral' is not a literal type}}
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/lambda-capture-type-deduction.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -verify -fsyntax-only %s
// RUN: %clang_cc1 -std=c++23 -verify -fsyntax-only %s

template <typename T, typename U>
constexpr bool is_same = false;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/lambda-expressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ static_assert([]() constexpr {
// be properly handled after D124351
constexpr int i = 2;
void foo() {
(void)[=][[gnu::aligned(i)]] () {}; // expected-warning{{C++2b extension}}
(void)[=][[gnu::aligned(i)]] () {}; // expected-warning{{C++23 extension}}
// CHECK: AlignedAttr
// CHECK-NEXT: ConstantExpr
// CHECK-NEXT: value: Int 2
Expand Down
4 changes: 2 additions & 2 deletions clang/test/SemaCXX/lambda-unevaluated.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++20 %s -Wno-c++2b-extensions -verify
// RUN: %clang_cc1 -std=c++2b %s -verify
// RUN: %clang_cc1 -std=c++20 %s -Wno-c++23-extensions -verify
// RUN: %clang_cc1 -std=c++23 %s -verify


template <auto> struct Nothing {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++20 -fms-extensions -Wno-microsoft %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++2b -fms-extensions -Wno-microsoft %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++23 -fms-extensions -Wno-microsoft %s

template <class T, class U>
struct Same {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/overloaded-operator-decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct PR10839 {

namespace PR14120 {
struct A {
static void operator()(int& i) { ++i; } // expected-warning{{is a C++2b extension}}
static void operator()(int& i) { ++i; } // expected-warning{{is a C++23 extension}}
};
void f() {
int i = 0;
Expand Down
8 changes: 4 additions & 4 deletions clang/test/SemaCXX/return-stack-addr.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx2b %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx23 %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx11_20 %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11_20,cxx11 %s

Expand Down Expand Up @@ -30,7 +30,7 @@ int* ret_local_array_element_const_index() {
int& ret_local_ref() {
int x = 1;
return x; // cxx11_20-warning {{reference to stack memory}}
// cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
// cxx23-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
}

int* ret_local_addrOf() {
Expand Down Expand Up @@ -156,9 +156,9 @@ void ret_from_lambda() {
(void) [=]() mutable -> int& { return a; };
(void) [=]() mutable -> int& { return b; };
(void) [&]() -> int& { int a; return a; }; // cxx11_20-warning {{reference to stack}}
// cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
// cxx23-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
(void) [=]() -> int& { int a; return a; }; // cxx11_20-warning {{reference to stack}}
// cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
// cxx23-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
(void) [&]() -> int& { int &a = b; return a; };
(void) [=]() mutable -> int& { int &a = b; return a; };

Expand Down
70 changes: 35 additions & 35 deletions clang/test/SemaCXX/size_t-literal.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -std=c++2b -triple x86_64-linux -Wpre-c++2b-compat -fsyntax-only -verify=cxx2b %s
// RUN: %clang_cc1 -std=c++23 -triple x86_64-linux -Wpre-c++23-compat -fsyntax-only -verify=cxx23 %s
// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux -fsyntax-only -verify=cxx20 %s
// RUN: %clang_cc1 -std=c++2b -triple i686-linux -fsyntax-only -verify=cxx2b-32 %s
// RUN: %clang_cc1 -std=c++23 -triple i686-linux -fsyntax-only -verify=cxx23-32 %s
// RUN: %clang_cc1 -x c -std=c11 -fsyntax-only -verify=c11 %s

#ifdef __cplusplus
Expand All @@ -17,83 +17,83 @@ struct is_same<T, T> { static constexpr bool value = true; };

void SSizeT(void) {
auto a1 = 1z;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a1), ssize_t>::value);

auto a2 = 1Z;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a2), ssize_t>::value);
}

void SizeT(void) {
auto a1 = 1uz;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a1), size_t>::value);

auto a2 = 1uZ;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a2), size_t>::value);

auto a3 = 1Uz;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a3), size_t>::value);

auto a4 = 1UZ;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a4), size_t>::value);

auto a5 = 1zu;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a5), size_t>::value);

auto a6 = 1Zu;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a6), size_t>::value);

auto a7 = 1zU;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a7), size_t>::value);

auto a8 = 1ZU;
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
// cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
static_assert(is_same<decltype(a8), size_t>::value);
}

void oor(void) {
#if __i386__
(void)3'000'000'000z; // cxx2b-32-error {{signed 'size_t' literal is out of range of possible signed 'size_t' values}}
(void)3'000'000'000z; // cxx23-32-error {{signed 'size_t' literal is out of range of possible signed 'size_t' values}}
(void)3'000'000'000uz;
(void)5'000'000'000uz; // cxx2b-32-error {{'size_t' literal is out of range of possible 'size_t' values}}
(void)5'000'000'000uz; // cxx23-32-error {{'size_t' literal is out of range of possible 'size_t' values}}

(void)0x80000000z;
(void)0x80000000uz;
(void)0x180000000uz; //cxx2b-32-error {{'size_t' literal is out of range of possible 'size_t' values}}
(void)0x180000000uz; //cxx23-32-error {{'size_t' literal is out of range of possible 'size_t' values}}
#endif
}

#else

void f(void) {
(void)1z; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1Z; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1uz; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1uZ; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1Uz; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1UZ; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1zu; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1Zu; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1zU; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1ZU; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1z; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1Z; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1uz; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1uZ; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1Uz; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1UZ; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1zu; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1Zu; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1zU; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
(void)1ZU; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
}

#endif
32 changes: 16 additions & 16 deletions clang/test/SemaObjCXX/block-capture.mm
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_2b,cxx11_2b,cxx2b %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_2b,cxx11_2b %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_2b,cxx11_2b %s
// RUN: %clang_cc1 -std=c++98 -fsyntax-only -fobjc-arc -fblocks -Wno-c++11-extensions -verify=cxx98_2b,cxx98 %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_23,cxx11_23,cxx23 %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_23,cxx11_23 %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_23,cxx11_23 %s
// RUN: %clang_cc1 -std=c++98 -fsyntax-only -fobjc-arc -fblocks -Wno-c++11-extensions -verify=cxx98_23,cxx98 %s

#define TEST(T) void test_##T() { \
__block T x; \
(void)^(void) { (void)x; }; \
}

struct CopyOnly {
CopyOnly(); // cxx2b-note {{not viable}}
CopyOnly(CopyOnly &); // cxx2b-note {{not viable}}
CopyOnly(); // cxx23-note {{not viable}}
CopyOnly(CopyOnly &); // cxx23-note {{not viable}}
};
TEST(CopyOnly); // cxx2b-error {{no matching constructor}}
TEST(CopyOnly); // cxx23-error {{no matching constructor}}

// Both ConstCopyOnly and NonConstCopyOnly are
// "pure" C++98 tests (pretend 'delete' means 'private').
Expand All @@ -28,16 +28,16 @@
struct NonConstCopyOnly {
NonConstCopyOnly();
NonConstCopyOnly(NonConstCopyOnly &);
NonConstCopyOnly(const NonConstCopyOnly &) = delete; // cxx11_2b-note {{marked deleted here}}
NonConstCopyOnly(const NonConstCopyOnly &) = delete; // cxx11_23-note {{marked deleted here}}
};
TEST(NonConstCopyOnly); // cxx11_2b-error {{call to deleted constructor}}
TEST(NonConstCopyOnly); // cxx11_23-error {{call to deleted constructor}}

struct CopyNoMove {
CopyNoMove();
CopyNoMove(CopyNoMove &);
CopyNoMove(CopyNoMove &&) = delete; // cxx98_2b-note {{marked deleted here}}
CopyNoMove(CopyNoMove &&) = delete; // cxx98_23-note {{marked deleted here}}
};
TEST(CopyNoMove); // cxx98_2b-error {{call to deleted constructor}}
TEST(CopyNoMove); // cxx98_23-error {{call to deleted constructor}}

struct MoveOnly {
MoveOnly();
Expand All @@ -49,9 +49,9 @@
struct NoCopyNoMove {
NoCopyNoMove();
NoCopyNoMove(NoCopyNoMove &) = delete;
NoCopyNoMove(NoCopyNoMove &&) = delete; // cxx98_2b-note {{marked deleted here}}
NoCopyNoMove(NoCopyNoMove &&) = delete; // cxx98_23-note {{marked deleted here}}
};
TEST(NoCopyNoMove); // cxx98_2b-error {{call to deleted constructor}}
TEST(NoCopyNoMove); // cxx98_23-error {{call to deleted constructor}}

struct ConvertingRVRef {
ConvertingRVRef();
Expand All @@ -69,11 +69,11 @@
ConvertingCLVRef(ConvertingCLVRef &);

struct X {};
ConvertingCLVRef(X &&); // cxx98_2b-note {{passing argument to parameter here}}
ConvertingCLVRef(X &&); // cxx98_23-note {{passing argument to parameter here}}
operator X() const &;
operator X() && = delete; // cxx98_2b-note {{marked deleted here}}
operator X() && = delete; // cxx98_23-note {{marked deleted here}}
};
TEST(ConvertingCLVRef); // cxx98_2b-error {{invokes a deleted function}}
TEST(ConvertingCLVRef); // cxx98_23-error {{invokes a deleted function}}

struct SubSubMove {};
struct SubMove : SubSubMove {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaOpenCLCXX/address-space-lambda.clcpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ __kernel void test_qual() {

[&] __private {} (); // expected-error{{no matching function for call to object of type '(lambda at}} expected-note{{candidate function not viable: 'this' object is in default address space, but method expects object in address space '__private'}}
#if __cplusplus <= 202002L
// expected-warning@-2{{lambda without a parameter clause is a C++2b extension}}
// expected-warning@-2{{lambda without a parameter clause is a C++23 extension}}
#endif

[&] () mutable __private {} ();
Expand Down
4 changes: 2 additions & 2 deletions clang/test/SemaTemplate/deduction.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1z
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++2b
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++23

// Template argument deduction with template template parameters.
template<typename T, template<T> class A>
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaTemplate/instantiate-subscript.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2b %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++23 %s

struct Sub0 {
int &operator[](int);
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaTemplate/instantiation-dependence.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -verify %s
// RUN: %clang_cc1 -std=c++23 -verify %s

// Ensure we substitute into instantiation-dependent but non-dependent
// constructs. The poster-child for this is...
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaTemplate/make_integer_seq.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -triple x86_64-linux-gnu -ast-dump -verify -xc++ < %s | FileCheck %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -triple x86_64-linux-gnu -ast-dump -verify -xc++ < %s | FileCheck %s

template <class A1, A1... A2> struct A {};

Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaTemplate/pr52909.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++20 -verify %s
// RUN: %clang_cc1 -std=c++2b -verify %s
// RUN: %clang_cc1 -std=c++23 -verify %s

namespace PR52905 {
template <class> concept C = true;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaTemplate/type_pack_element.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -triple x86_64-linux-gnu -ast-dump -verify -xc++ < %s | FileCheck %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -triple x86_64-linux-gnu -ast-dump -verify -xc++ < %s | FileCheck %s

using test1 = __type_pack_element<0, int>;
// CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}} <<stdin>:3:1, col:41> col:7 test1 '__type_pack_element<0, int>':'int'
Expand Down
2 changes: 1 addition & 1 deletion clang/www/OpenProjects.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h1>Open Clang Projects</h1>
</ul>
</li>

<li><b>Continue work on C++20, C++2b, and C2x support</b>:
<li><b>Continue work on C++20, C++23, and C2x support</b>:
There are still several C++20 features to complete, and work has begun on
supporting the latest language standards. Please see the
<a href="cxx_status.html">C++ status report page</a> to find out what is
Expand Down
14 changes: 7 additions & 7 deletions clang/www/cxx_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ <h1>C++ Support in Clang</h1>
<td class="partial" align="center">Partial</td>
</tr>
<tr>
<td><a href="#cxx23">C++2b (tentatively C++23)</a></td>
<td><tt>-std=c++2b</tt></td>
<td><a href="#cxx23">C++23</a></td>
<td><tt>-std=c++23</tt></td>
<td class="partial" align="center">Partial</td>
</tr>
</table>
Expand Down Expand Up @@ -1290,20 +1290,20 @@ <h2 id="cxx20">C++20 implementation status</h2>
</p>
</details>

<h2 id="cxx23">C++2b implementation status</h2>
<h2 id="cxx23">C++23 implementation status</h2>

<p>Clang has support for some of the features of the C++ standard following
C++20, informally referred to as C++2b.</p>
<!-- TODO add link to the ISO Standard after it's published. -->
<p>Clang has support for some of the features of the ISO C++ 2023 standard.</p>

<p>You can use Clang in C++2b mode with the <code>-std=c++2b</code> option.</p>
<p>You can use Clang in C++23 mode with the <code>-std=c++23</code> option.</p>

<details open>
<summary>List of features and minimum Clang version with support</summary>

<table width="689" border="1" cellspacing="0">
<tr>
<th>Language Feature</th>
<th>C++2b Proposal</th>
<th>C++23 Proposal</th>
<th>Available in Clang?</th>
</tr>
<!-- Fall 2020 papers -->
Expand Down