[clang] Use -std=c++23 instead of -std=c++2b

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
This commit is contained in:
Mark de Wever 2023-04-30 15:27:00 +02:00
parent 6d6880554c
commit ba15d186e5
137 changed files with 633 additions and 625 deletions

View File

@ -78,7 +78,7 @@ RedundantStringCStrCheck::RedundantStringCStrCheck(StringRef Name,
Options.get("StringParameterFunctions", ""))) {
if (getLangOpts().CPlusPlus20)
StringParameterFunctions.push_back("::std::format");
if (getLangOpts().CPlusPlus2b)
if (getLangOpts().CPlusPlus23)
StringParameterFunctions.push_back("::std::print");
}

View File

@ -47,8 +47,8 @@ llvm::StringLiteral mandatoryHeader(Lang L) {
LangStandard::Kind standardFromOpts(const LangOptions &LO) {
if (LO.CPlusPlus) {
if (LO.CPlusPlus2b)
return LangStandard::lang_cxx2b;
if (LO.CPlusPlus23)
return LangStandard::lang_cxx23;
if (LO.CPlusPlus20)
return LangStandard::lang_cxx20;
if (LO.CPlusPlus17)

View File

@ -193,13 +193,13 @@ Language Selection and Mode Options
ISO C++ 2020 with amendments and GNU extensions
| ``c++2b``
| ``c++23``
Working draft for ISO C++ 2023
ISO C++ 2023 with amendments
| ``gnu++2b``
| ``gnu++23``
Working draft for ISO C++ 2023 with GNU extensions
ISO C++ 2023 with amendments and GNU extensions
The default C++ language standard is ``gnu++17``.

View File

@ -93,7 +93,7 @@ C++20 Feature Support
error again in the future once there is a less fragile way to mark a module
as being part of the implementation rather than a user module.
C++2b Feature Support
C++23 Feature Support
^^^^^^^^^^^^^^^^^^^^^
- Implemented `P2036R3: Change scope of lambda trailing-return-type <https://wg21.link/P2036R3>`_
@ -181,6 +181,8 @@ Non-comprehensive list of changes in this release
New Compiler Flags
------------------
- The flag ``-std=c++23`` has been added. This behaves the same as the existing
flag ``-std=c++2b``.
Deprecated Compiler Flags
-------------------------
@ -386,7 +388,7 @@ Bug Fixes to C++ Support
(`#58674 <https://github.com/llvm/llvm-project/issues/58674>`_)
- Fix incorrect deletion of the default constructor of unions in some
cases. (`#48416 <https://github.com/llvm/llvm-project/issues/48416>`_)
- No longer issue a pre-C++2b compatibility warning in ``-pedantic`` mode
- No longer issue a pre-C++23 compatibility warning in ``-pedantic`` mode
regading overloaded `operator[]` with more than one parmeter or for static
lambdas. (`#61582 <https://github.com/llvm/llvm-project/issues/61582>`_)
- Stop stripping CV qualifiers from the type of ``this`` when capturing it by value in

View File

@ -434,7 +434,7 @@ The following example is not allowed:
.. code-block:: console
$ clang++ -std=c++20 M.cppm --precompile -o M.pcm
$ clang++ -std=c++2b Use.cpp -fprebuilt-module-path=.
$ clang++ -std=c++23 Use.cpp -fprebuilt-module-path=.
The compiler would reject the example due to the inconsistent language options.
Not all options are language options.
@ -611,7 +611,7 @@ The following describes issues in the current implementation of modules.
Please see https://github.com/llvm/llvm-project/labels/clang%3Amodules for more issues
or file a new issue if you don't find an existing one.
If you're going to create a new issue for standard C++ modules,
please start the title with ``[C++20] [Modules]`` (or ``[C++2b] [Modules]``, etc)
please start the title with ``[C++20] [Modules]`` (or ``[C++23] [Modules]``, etc)
and add the label ``clang:modules`` (if you have permissions for that).
For higher level support for proposals, you could visit https://clang.llvm.org/cxx_status.html.

View File

@ -210,14 +210,14 @@ def ext_cxx11_longlong : Extension<
def warn_cxx98_compat_longlong : Warning<
"'long long' is incompatible with C++98">,
InGroup<CXX98CompatPedantic>, DefaultIgnore;
def ext_cxx2b_size_t_suffix : ExtWarn<
"'size_t' suffix for literals is a C++2b extension">,
InGroup<CXX2b>;
def ext_cxx23_size_t_suffix : ExtWarn<
"'size_t' suffix for literals is a C++23 extension">,
InGroup<CXX23>;
def warn_cxx20_compat_size_t_suffix : Warning<
"'size_t' suffix for literals is incompatible with C++ standards before "
"C++2b">, InGroup<CXXPre2bCompat>, DefaultIgnore;
def err_cxx2b_size_t_suffix: Error<
"'size_t' suffix for literals is a C++2b feature">;
"C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
def err_cxx23_size_t_suffix: Error<
"'size_t' suffix for literals is a C++23 feature">;
def err_size_t_literal_too_large: Error<
"%select{signed |}0'size_t' literal is out of range of possible "
"%select{signed |}0'size_t' values">;

View File

@ -304,9 +304,9 @@ def CXXPre20CompatPedantic : DiagGroup<"pre-c++20-compat-pedantic",
[CXXPre20Compat]>;
def : DiagGroup<"c++98-c++11-c++14-c++17-compat-pedantic",
[CXXPre20CompatPedantic]>;
def CXXPre2bCompat : DiagGroup<"pre-c++2b-compat">;
def CXXPre2bCompatPedantic :
DiagGroup<"pre-c++2b-compat-pedantic", [CXXPre2bCompat]>;
def CXXPre23Compat : DiagGroup<"pre-c++23-compat">;
def CXXPre23CompatPedantic :
DiagGroup<"pre-c++23-compat-pedantic", [CXXPre23Compat]>;
def CXX98CompatBindToTemporaryCopy :
DiagGroup<"c++98-compat-bind-to-temporary-copy">;
@ -321,7 +321,7 @@ def CXX98Compat : DiagGroup<"c++98-compat",
CXXPre14Compat,
CXXPre17Compat,
CXXPre20Compat,
CXXPre2bCompat]>;
CXXPre23Compat]>;
// Warnings for C++11 features which are Extensions in C++98 mode.
def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic",
[CXX98Compat,
@ -330,7 +330,7 @@ def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic",
CXXPre14CompatPedantic,
CXXPre17CompatPedantic,
CXXPre20CompatPedantic,
CXXPre2bCompatPedantic]>;
CXXPre23CompatPedantic]>;
def CXX11Narrowing : DiagGroup<"c++11-narrowing">;
@ -360,39 +360,39 @@ def CXX11Compat : DiagGroup<"c++11-compat",
CXXPre14Compat,
CXXPre17Compat,
CXXPre20Compat,
CXXPre2bCompat]>;
CXXPre23Compat]>;
def : DiagGroup<"c++0x-compat", [CXX11Compat]>;
def CXX11CompatPedantic : DiagGroup<"c++11-compat-pedantic",
[CXX11Compat,
CXXPre14CompatPedantic,
CXXPre17CompatPedantic,
CXXPre20CompatPedantic,
CXXPre2bCompatPedantic]>;
CXXPre23CompatPedantic]>;
def CXX14Compat : DiagGroup<"c++14-compat", [CXXPre17Compat,
CXXPre20Compat,
CXXPre2bCompat]>;
CXXPre23Compat]>;
def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic",
[CXX14Compat,
CXXPre17CompatPedantic,
CXXPre20CompatPedantic,
CXXPre2bCompatPedantic]>;
CXXPre23CompatPedantic]>;
def CXX17Compat : DiagGroup<"c++17-compat", [DeprecatedRegister,
DeprecatedIncrementBool,
CXX17CompatMangling,
CXXPre20Compat,
CXXPre2bCompat]>;
CXXPre23Compat]>;
def CXX17CompatPedantic : DiagGroup<"c++17-compat-pedantic",
[CXX17Compat,
CXXPre20CompatPedantic,
CXXPre2bCompatPedantic]>;
CXXPre23CompatPedantic]>;
def : DiagGroup<"c++1z-compat", [CXX17Compat]>;
def CXX20Compat : DiagGroup<"c++20-compat", [CXXPre2bCompat]>;
def CXX20Compat : DiagGroup<"c++20-compat", [CXXPre23Compat]>;
def CXX20CompatPedantic : DiagGroup<"c++20-compat-pedantic",
[CXX20Compat,
CXXPre2bCompatPedantic]>;
CXXPre23CompatPedantic]>;
def : DiagGroup<"c++2a-compat", [CXX20Compat]>;
def : DiagGroup<"c++2a-compat-pedantic", [CXX20CompatPedantic]>;
@ -1108,9 +1108,9 @@ def CXX17 : DiagGroup<"c++17-extensions", [CXX17Attrs]>;
// earlier C++ versions.
def CXX20 : DiagGroup<"c++20-extensions", [CXX20Designator, CXX20Attrs]>;
// A warning group for warnings about using C++2b features as extensions in
// A warning group for warnings about using C++23 features as extensions in
// earlier C++ versions.
def CXX2b : DiagGroup<"c++2b-extensions">;
def CXX23 : DiagGroup<"c++23-extensions">;
def : DiagGroup<"c++0x-extensions", [CXX11]>;
def : DiagGroup<"c++1y-extensions", [CXX14]>;

View File

@ -138,13 +138,13 @@ def ext_mathematical_notation : ExtWarn<
def ext_delimited_escape_sequence : Extension<
"%select{delimited|named}0 escape sequences are a "
"%select{Clang|C++2b}1 extension">,
"%select{Clang|C++23}1 extension">,
InGroup<DiagGroup<"delimited-escape-sequence-extension">>;
def warn_cxx2b_delimited_escape_sequence : Warning<
def warn_cxx23_delimited_escape_sequence : Warning<
"%select{delimited|named}0 escape sequences are "
"incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
"incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def err_delimited_escape_empty : Error<
"delimited escape sequence cannot be empty">;
@ -396,10 +396,10 @@ def ext_pp_include_next_directive : Extension<
"#include_next is a language extension">, InGroup<GNUIncludeNext>;
def ext_pp_warning_directive : Extension<
"#warning is a %select{C2x|C++2b}0 extension">;
def warn_cxx2b_compat_warning_directive : Warning<
"#warning is incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
"#warning is a %select{C2x|C++23}0 extension">;
def warn_cxx23_compat_warning_directive : Warning<
"#warning is incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def warn_c2x_compat_warning_directive : Warning<
"#warning is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
@ -739,14 +739,14 @@ def ext_c2x_pp_directive : ExtWarn<
"use of a '#%select{<BUG IF SEEN>|elifdef|elifndef}0' directive "
"is a C2x extension">,
InGroup<C2x>;
def warn_cxx2b_compat_pp_directive : Warning<
def warn_cxx23_compat_pp_directive : Warning<
"use of a '#%select{<BUG IF SEEN>|elifdef|elifndef}0' directive "
"is incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
def ext_cxx2b_pp_directive : ExtWarn<
"is incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def ext_cxx23_pp_directive : ExtWarn<
"use of a '#%select{<BUG IF SEEN>|elifdef|elifndef}0' directive "
"is a C++2b extension">,
InGroup<CXX2b>;
"is a C++23 extension">,
InGroup<CXX23>;
def err_pp_visibility_non_macro : Error<"no macro named %0">;

View File

@ -300,14 +300,14 @@ def ext_c_label_end_of_compound_statement : ExtWarn<
"label at end of compound statement is a C2x extension">,
InGroup<C2x>;
def ext_cxx_label_end_of_compound_statement : ExtWarn<
"label at end of compound statement is a C++2b extension">,
InGroup<CXX2b>;
"label at end of compound statement is a C++23 extension">,
InGroup<CXX23>;
def warn_c2x_compat_label_end_of_compound_statement : Warning<
"label at end of compound statement is incompatible with C standards before C2x">,
InGroup<CPre2xCompat>, DefaultIgnore;
def warn_cxx20_compat_label_end_of_compound_statement : Warning<
"label at end of compound statement is incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
"label at end of compound statement is incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def err_address_of_label_outside_fn : Error<
"use of address-of-label extension outside of a function body">;
def err_asm_operand_wide_string_literal : Error<
@ -566,11 +566,11 @@ def err_expected_init_in_condition_lparen : Error<
def err_extraneous_rparen_in_condition : Error<
"extraneous ')' after condition, expected a statement">;
def ext_alias_in_init_statement : ExtWarn<
"alias declaration in this context is a C++2b extension">,
InGroup<CXX2b>;
"alias declaration in this context is a C++23 extension">,
InGroup<CXX23>;
def warn_cxx20_alias_in_init_statement : Warning<
"alias declaration in this context is incompatible with C++ standards before C++2b">,
DefaultIgnore, InGroup<CXXPre2bCompat>;
"alias declaration in this context is incompatible with C++ standards before C++23">,
DefaultIgnore, InGroup<CXXPre23Compat>;
def warn_dangling_else : Warning<
"add explicit braces to avoid dangling else">,
InGroup<DanglingElse>;
@ -652,11 +652,11 @@ def warn_cxx14_compat_constexpr_if : Warning<
"constexpr if is incompatible with C++ standards before C++17">,
DefaultIgnore, InGroup<CXXPre17Compat>;
def ext_consteval_if : ExtWarn<
"consteval if is a C++2b extension">,
InGroup<CXX2b>;
"consteval if is a C++23 extension">,
InGroup<CXX23>;
def warn_cxx20_compat_consteval_if : Warning<
"consteval if is incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
"consteval if is incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def ext_init_statement : ExtWarn<
"'%select{if|switch}0' initialization statements are a C++17 extension">,
@ -1014,14 +1014,14 @@ def err_lambda_capture_multiple_ellipses : Error<
def err_capture_default_first : Error<
"capture default must be first">;
def ext_decl_attrs_on_lambda : ExtWarn<
"an attribute specifier sequence in this position is a C++2b extension">,
InGroup<CXX2b>;
"an attribute specifier sequence in this position is a C++23 extension">,
InGroup<CXX23>;
def ext_lambda_missing_parens : ExtWarn<
"lambda without a parameter clause is a C++2b extension">,
InGroup<CXX2b>;
"lambda without a parameter clause is a C++23 extension">,
InGroup<CXX23>;
def warn_cxx20_compat_decl_attrs_on_lambda : Warning<
"an attribute specifier sequence in this position is incompatible with C++ "
"standards before C++2b">, InGroup<CXXPre2bCompat>, DefaultIgnore;
"standards before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
// C++17 lambda expressions
def err_expected_star_this_capture : Error<
@ -1044,12 +1044,12 @@ def warn_cxx17_compat_lambda_template_parameter_list: Warning<
def err_lambda_template_parameter_list_empty : Error<
"lambda template parameter list cannot be empty">;
// C++2b static lambdas
// C++23 static lambdas
def err_static_lambda: ExtWarn<
"static lambdas are a C++2b extension">, InGroup<CXX2b>;
"static lambdas are a C++23 extension">, InGroup<CXX23>;
def warn_cxx20_compat_static_lambda : Warning<
"static lambdas are incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
"static lambdas are incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def err_static_mutable_lambda : Error<
"lambda cannot be both mutable and static">;
def err_static_lambda_captures : Error<

View File

@ -2370,7 +2370,7 @@ def err_auto_expr_init_paren_braces : Error<
"%select{parenthesized|nested}0 initializer list">;
def warn_cxx20_compat_auto_expr : Warning<
"'auto' as a functional-style cast is incompatible with C++ standards "
"before C++2b">, InGroup<CXXPre2bCompat>, DefaultIgnore;
"before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
def err_auto_missing_trailing_return : Error<
"'auto' return without trailing return type; deduced return types are a "
"C++14 extension">;
@ -2727,13 +2727,13 @@ def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
"use of this statement in a constexpr %select{function|constructor}0 "
"is incompatible with C++ standards before C++20">,
InGroup<CXXPre20Compat>, DefaultIgnore;
def ext_constexpr_body_invalid_stmt_cxx2b : ExtWarn<
def ext_constexpr_body_invalid_stmt_cxx23 : ExtWarn<
"use of this statement in a constexpr %select{function|constructor}0 "
"is a C++2b extension">, InGroup<CXX2b>;
"is a C++23 extension">, InGroup<CXX23>;
def warn_cxx20_compat_constexpr_body_invalid_stmt : Warning<
"use of this statement in a constexpr %select{function|constructor}0 "
"is incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
"is incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def ext_constexpr_type_definition : ExtWarn<
"type definition in a constexpr %select{function|constructor}0 "
"is a C++14 extension">, InGroup<CXX14>;
@ -2754,15 +2754,15 @@ def warn_cxx11_compat_constexpr_local_var : Warning<
def ext_constexpr_static_var : ExtWarn<
"definition of a %select{static|thread_local}1 variable "
"in a constexpr %select{function|constructor}0 "
"is a C++2b extension">, InGroup<CXX2b>;
"is a C++23 extension">, InGroup<CXX23>;
def warn_cxx20_compat_constexpr_var : Warning<
"definition of a %select{static variable|thread_local variable|variable "
"of non-literal type}1 in a constexpr %select{function|constructor}0 "
"is incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
"is incompatible with C++ standards before C++23">,
InGroup<CXXPre23Compat>, DefaultIgnore;
def err_constexpr_local_var_non_literal_type : Error<
"variable of non-literal type %1 cannot be defined in a constexpr "
"%select{function|constructor}0 before C++2b">;
"%select{function|constructor}0 before C++23">;
def ext_constexpr_local_var_no_init : ExtWarn<
"uninitialized variable in a constexpr %select{function|constructor}0 "
"is a C++20 extension">, InGroup<CXX20>;
@ -6744,7 +6744,7 @@ def err_arithmetic_nonfragile_interface : Error<
def warn_deprecated_comma_subscript : Warning<
"top-level comma expression in array subscript is deprecated "
"in C++20 and unsupported in C++2b">,
"in C++20 and unsupported in C++23">,
InGroup<DeprecatedCommaSubscript>;
def ext_subscript_non_lvalue : Extension<
@ -9148,9 +9148,9 @@ def err_operator_overload_needs_class_or_enum : Error<
def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
def warn_cxx20_compat_operator_overload_static : Warning<
"declaring overloaded %0 as 'static' is incompatible with C++ standards "
"before C++2b">, InGroup<CXXPre2bCompat>, DefaultIgnore;
"before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
def ext_operator_overload_static : ExtWarn<
"declaring overloaded %0 as 'static' is a C++2b extension">, InGroup<CXX2b>;
"declaring overloaded %0 as 'static' is a C++23 extension">, InGroup<CXX23>;
def err_operator_overload_static : Error<
"overloaded %0 cannot be a static member function">;
def err_operator_overload_default_arg : Error<
@ -9158,9 +9158,9 @@ def err_operator_overload_default_arg : Error<
def ext_subscript_overload : Warning<
"overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a "
"C++2b extension">, InGroup<CXXPre2bCompat>, DefaultIgnore;
"C++23 extension">, InGroup<CXXPre23Compat>, DefaultIgnore;
def error_subscript_overload : Error<
"overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++2b">;
"overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++23">;
def err_operator_overload_must_be : Error<
"overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "

View File

@ -97,7 +97,7 @@ LANGOPT(CPlusPlus11 , 1, 0, "C++11")
LANGOPT(CPlusPlus14 , 1, 0, "C++14")
LANGOPT(CPlusPlus17 , 1, 0, "C++17")
LANGOPT(CPlusPlus20 , 1, 0, "C++20")
LANGOPT(CPlusPlus2b , 1, 0, "C++2b")
LANGOPT(CPlusPlus23 , 1, 0, "C++23")
LANGOPT(ObjC , 1, 0, "Objective-C")
BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0,
"Objective-C auto-synthesized properties")

View File

@ -55,7 +55,7 @@ enum LangFeatures {
CPlusPlus14 = (1 << 7),
CPlusPlus17 = (1 << 8),
CPlusPlus20 = (1 << 9),
CPlusPlus2b = (1 << 10),
CPlusPlus23 = (1 << 10),
Digraphs = (1 << 11),
GNUMode = (1 << 12),
HexFloat = (1 << 13),
@ -118,8 +118,8 @@ public:
/// isCPlusPlus20 - Language is a C++20 variant (or later).
bool isCPlusPlus20() const { return Flags & CPlusPlus20; }
/// isCPlusPlus2b - Language is a post-C++20 variant (or later).
bool isCPlusPlus2b() const { return Flags & CPlusPlus2b; }
/// isCPlusPlus23 - Language is a post-C++23 variant (or later).
bool isCPlusPlus23() const { return Flags & CPlusPlus23; }
/// hasDigraphs - Language supports digraphs.
bool hasDigraphs() const { return Flags & Digraphs; }

View File

@ -151,15 +151,17 @@ LANGSTANDARD(gnucxx20, "gnu++20",
CPlusPlus20 | Digraphs | HexFloat | GNUMode)
LANGSTANDARD_ALIAS_DEPR(gnucxx20, "gnu++2a")
LANGSTANDARD(cxx2b, "c++2b",
CXX, "Working draft for ISO C++ 2023 DIS",
LANGSTANDARD(cxx23, "c++23",
CXX, "ISO C++ 2023 DIS",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
CPlusPlus20 | CPlusPlus2b | Digraphs | HexFloat)
CPlusPlus20 | CPlusPlus23 | Digraphs | HexFloat)
LANGSTANDARD_ALIAS_DEPR(cxx23, "c++2b")
LANGSTANDARD(gnucxx2b, "gnu++2b",
CXX, "Working draft for ISO C++ 2023 DIS with GNU extensions",
LANGSTANDARD(gnucxx23, "gnu++23",
CXX, "ISO C++ 2023 DIS with GNU extensions",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
CPlusPlus20 | CPlusPlus2b | Digraphs | HexFloat | GNUMode)
CPlusPlus20 | CPlusPlus23 | Digraphs | HexFloat | GNUMode)
LANGSTANDARD_ALIAS_DEPR(gnucxx23, "gnu++2b")
// OpenCL
LANGSTANDARD(opencl10, "cl1.0",

View File

@ -63,7 +63,7 @@ public:
bool isUnsigned : 1;
bool isLong : 1; // This is *not* set for long long.
bool isLongLong : 1;
bool isSizeT : 1; // 1z, 1uz (C++2b)
bool isSizeT : 1; // 1z, 1uz (C++23)
bool isHalf : 1; // 1.0h
bool isFloat : 1; // 1.0f
bool isImaginary : 1; // 1.0i

View File

@ -1370,7 +1370,7 @@ public:
return Context == ExpressionEvaluationContext::ImmediateFunctionContext ||
(Context == ExpressionEvaluationContext::DiscardedStatement &&
InImmediateFunctionContext) ||
// C++2b [expr.const]p14:
// C++23 [expr.const]p14:
// An expression or conversion is in an immediate function
// context if it is potentially evaluated and either:
// * its innermost enclosing non-block scope is a function

View File

@ -5043,7 +5043,7 @@ static EvalStmtResult EvaluateSwitch(StmtResult &Result, EvalInfo &Info,
static bool CheckLocalVariableDeclaration(EvalInfo &Info, const VarDecl *VD) {
// An expression E is a core constant expression unless the evaluation of E
// would evaluate one of the following: [C++2b] - a control flow that passes
// would evaluate one of the following: [C++23] - a control flow that passes
// through a declaration of a variable with static or thread storage duration
// unless that variable is usable in constant expressions.
if (VD->isLocalVarDecl() && VD->isStaticLocal() &&

View File

@ -117,7 +117,7 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang,
Opts.CPlusPlus14 = Std.isCPlusPlus14();
Opts.CPlusPlus17 = Std.isCPlusPlus17();
Opts.CPlusPlus20 = Std.isCPlusPlus20();
Opts.CPlusPlus2b = Std.isCPlusPlus2b();
Opts.CPlusPlus23 = Std.isCPlusPlus23();
Opts.GNUMode = Std.isGNUMode();
Opts.GNUCVersion = 0;
Opts.HexFloats = Std.hasHexFloats();

View File

@ -214,7 +214,8 @@ static void addVisualCDefines(const LangOptions &Opts, MacroBuilder &Builder) {
Builder.defineMacro("_HAS_CHAR16_T_LANGUAGE_SUPPORT", Twine(1));
if (Opts.isCompatibleWithMSVC(LangOptions::MSVC2015)) {
if (Opts.CPlusPlus2b)
if (Opts.CPlusPlus23)
// TODO update to the proper value.
Builder.defineMacro("_MSVC_LANG", "202004L");
else if (Opts.CPlusPlus20)
Builder.defineMacro("_MSVC_LANG", "202002L");

View File

@ -1395,8 +1395,9 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
const Arg *Std = Args.getLastArg(options::OPT_std_EQ);
ModulesModeCXX20 =
!Args.hasArg(options::OPT_fmodules) && Std &&
(Std->containsValue("c++20") || Std->containsValue("c++2b") ||
Std->containsValue("c++2a") || Std->containsValue("c++latest"));
(Std->containsValue("c++20") || Std->containsValue("c++2a") ||
Std->containsValue("c++23") || Std->containsValue("c++2b") ||
Std->containsValue("c++latest"));
// Process -fmodule-header{=} flags.
if (Arg *A = Args.getLastArg(options::OPT_fmodule_header_EQ,

View File

@ -3673,7 +3673,8 @@ static bool RenderModulesOptions(Compilation &C, const Driver &D,
bool HaveStdCXXModules =
IsCXX && Std &&
(Std->containsValue("c++2a") || Std->containsValue("c++20") ||
Std->containsValue("c++2b") || Std->containsValue("c++latest"));
Std->containsValue("c++2b") || Std->containsValue("c++23") ||
Std->containsValue("c++latest"));
bool HaveModules = HaveStdCXXModules;
// -fmodules enables the use of precompiled modules (off by default).
@ -6637,7 +6638,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
.Case("c++14", "-std=c++14")
.Case("c++17", "-std=c++17")
.Case("c++20", "-std=c++20")
.Case("c++latest", "-std=c++2b")
// TODO add c++23 when MSVC supports it.
.Case("c++latest", "-std=c++23")
.Default("");
if (LanguageStandard.empty())
D.Diag(clang::diag::warn_drv_unused_argument)

View File

@ -452,7 +452,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
} else {
// -- __cplusplus
// FIXME: Use correct value for C++23.
if (LangOpts.CPlusPlus2b)
if (LangOpts.CPlusPlus23)
Builder.defineMacro("__cplusplus", "202101L");
// [C++20] The integer literal 202002L.
else if (LangOpts.CPlusPlus20)
@ -606,7 +606,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
Builder.defineMacro("__cpp_unicode_literals", "200710L");
Builder.defineMacro("__cpp_user_defined_literals", "200809L");
Builder.defineMacro("__cpp_lambdas", "200907L");
Builder.defineMacro("__cpp_constexpr", LangOpts.CPlusPlus2b ? "202211L"
Builder.defineMacro("__cpp_constexpr", LangOpts.CPlusPlus23 ? "202211L"
: LangOpts.CPlusPlus20 ? "201907L"
: LangOpts.CPlusPlus17 ? "201603L"
: LangOpts.CPlusPlus14 ? "201304L"
@ -690,15 +690,15 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
//Builder.defineMacro("__cpp_modules", "201907L");
Builder.defineMacro("__cpp_using_enum", "201907L");
}
// C++2b features.
if (LangOpts.CPlusPlus2b) {
// C++23 features.
if (LangOpts.CPlusPlus23) {
Builder.defineMacro("__cpp_implicit_move", "202011L");
Builder.defineMacro("__cpp_size_t_suffix", "202011L");
Builder.defineMacro("__cpp_if_consteval", "202106L");
Builder.defineMacro("__cpp_multidimensional_subscript", "202211L");
}
// We provide those C++2b features as extensions in earlier language modes, so
// We provide those C++23 features as extensions in earlier language modes, so
// we also define their feature test macros.
if (LangOpts.CPlusPlus11)
Builder.defineMacro("__cpp_static_call_operator", "202207L");

View File

@ -49,7 +49,7 @@ extern "C" {
in C2x mode; switch to the correct values once they've been published. */
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 202000L) || \
defined(__cplusplus)
/* ATOMIC_VAR_INIT was removed in C2x, but still remains in C++2b. */
/* ATOMIC_VAR_INIT was removed in C2x, but still remains in C++23. */
#define ATOMIC_VAR_INIT(value) (value)
#endif

View File

@ -3348,8 +3348,8 @@ std::optional<uint32_t> Lexer::tryReadNumericUCN(const char *&StartPtr,
}
if (Delimited && PP) {
Diag(SlashLoc, PP->getLangOpts().CPlusPlus2b
? diag::warn_cxx2b_delimited_escape_sequence
Diag(SlashLoc, PP->getLangOpts().CPlusPlus23
? diag::warn_cxx23_delimited_escape_sequence
: diag::ext_delimited_escape_sequence)
<< /*delimited*/ 0 << (PP->getLangOpts().CPlusPlus ? 1 : 0);
}
@ -3436,8 +3436,8 @@ std::optional<uint32_t> Lexer::tryReadNamedUCN(const char *&StartPtr,
}
if (Diagnose && Match)
Diag(SlashLoc, PP->getLangOpts().CPlusPlus2b
? diag::warn_cxx2b_delimited_escape_sequence
Diag(SlashLoc, PP->getLangOpts().CPlusPlus23
? diag::warn_cxx23_delimited_escape_sequence
: diag::ext_delimited_escape_sequence)
<< /*named*/ 1 << (PP->getLangOpts().CPlusPlus ? 1 : 0);

View File

@ -312,7 +312,7 @@ static unsigned ProcessCharEscape(const char *ThisTokBegin,
<< tok::r_brace;
else if (!HadError) {
Diag(Diags, Features, Loc, ThisTokBegin, EscapeBegin, ThisTokBuf,
Features.CPlusPlus2b ? diag::warn_cxx2b_delimited_escape_sequence
Features.CPlusPlus23 ? diag::warn_cxx23_delimited_escape_sequence
: diag::ext_delimited_escape_sequence)
<< /*delimited*/ 0 << (Features.CPlusPlus ? 1 : 0);
}
@ -641,7 +641,7 @@ static bool ProcessUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf,
if ((IsDelimitedEscapeSequence || IsNamedEscapeSequence) && Diags)
Diag(Diags, Features, Loc, ThisTokBegin, UcnBegin, ThisTokBuf,
Features.CPlusPlus2b ? diag::warn_cxx2b_delimited_escape_sequence
Features.CPlusPlus23 ? diag::warn_cxx23_delimited_escape_sequence
: diag::ext_delimited_escape_sequence)
<< (IsNamedEscapeSequence ? 1 : 0) << (Features.CPlusPlus ? 1 : 0);

View File

@ -434,7 +434,7 @@ void Preprocessor::SuggestTypoedDirective(const Token &Tok,
std::vector<StringRef> Candidates = {
"if", "ifdef", "ifndef", "elif", "else", "endif"
};
if (LangOpts.C2x || LangOpts.CPlusPlus2b)
if (LangOpts.C2x || LangOpts.CPlusPlus23)
Candidates.insert(Candidates.end(), {"elifdef", "elifndef"});
if (std::optional<StringRef> Sugg = findSimilarStr(Directive, Candidates)) {
@ -745,12 +745,12 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation HashTokenLoc,
if (!CondInfo.WasSkipping)
SkippingRangeState.endLexPass(Hashptr);
// Warn if using `#elifdef` & `#elifndef` in not C2x & C++2b mode even
// Warn if using `#elifdef` & `#elifndef` in not C2x & C++23 mode even
// if this branch is in a skipping block.
unsigned DiagID;
if (LangOpts.CPlusPlus)
DiagID = LangOpts.CPlusPlus2b ? diag::warn_cxx2b_compat_pp_directive
: diag::ext_cxx2b_pp_directive;
DiagID = LangOpts.CPlusPlus23 ? diag::warn_cxx23_compat_pp_directive
: diag::ext_cxx23_pp_directive;
else
DiagID = LangOpts.C2x ? diag::warn_c2x_compat_pp_directive
: diag::ext_c2x_pp_directive;
@ -1256,10 +1256,10 @@ void Preprocessor::HandleDirective(Token &Result) {
case tok::pp_warning:
if (LangOpts.CPlusPlus)
Diag(Result, LangOpts.CPlusPlus2b
? diag::warn_cxx2b_compat_warning_directive
Diag(Result, LangOpts.CPlusPlus23
? diag::warn_cxx23_compat_warning_directive
: diag::ext_pp_warning_directive)
<< /*C++2b*/ 1;
<< /*C++23*/ 1;
else
Diag(Result, LangOpts.C2x ? diag::warn_c2x_compat_warning_directive
: diag::ext_pp_warning_directive)
@ -3423,14 +3423,14 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
: PED_Elifndef;
++NumElse;
// Warn if using `#elifdef` & `#elifndef` in not C2x & C++2b mode.
// Warn if using `#elifdef` & `#elifndef` in not C2x & C++23 mode.
switch (DirKind) {
case PED_Elifdef:
case PED_Elifndef:
unsigned DiagID;
if (LangOpts.CPlusPlus)
DiagID = LangOpts.CPlusPlus2b ? diag::warn_cxx2b_compat_pp_directive
: diag::ext_cxx2b_pp_directive;
DiagID = LangOpts.CPlusPlus23 ? diag::warn_cxx23_compat_pp_directive
: diag::ext_cxx23_pp_directive;
else
DiagID = LangOpts.C2x ? diag::warn_c2x_compat_pp_directive
: diag::ext_c2x_pp_directive;

View File

@ -323,13 +323,13 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
PP.Diag(PeekTok, diag::ext_c99_longlong);
}
// 'z/uz' literals are a C++2b feature.
// 'z/uz' literals are a C++23 feature.
if (Literal.isSizeT)
PP.Diag(PeekTok, PP.getLangOpts().CPlusPlus
? PP.getLangOpts().CPlusPlus2b
? PP.getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_size_t_suffix
: diag::ext_cxx2b_size_t_suffix
: diag::err_cxx2b_size_t_suffix);
: diag::ext_cxx23_size_t_suffix
: diag::err_cxx23_size_t_suffix);
// 'wb/uwb' literals are a C2x feature. We explicitly do not support the
// suffix in C++ as an extension because a library-based UDL that resolves

View File

@ -1076,7 +1076,7 @@ SourceLocation Parser::ParseDecltypeSpecifier(DeclSpec &DS) {
// Check for C++1y 'decltype(auto)'.
if (Tok.is(tok::kw_auto) && NextToken().is(tok::r_paren)) {
// the typename-specifier in a function-style cast expression may
// be 'auto' since C++2b.
// be 'auto' since C++23.
Diag(Tok.getLocation(),
getLangOpts().CPlusPlus14
? diag::warn_cxx11_compat_decltype_auto_type_specifier

View File

@ -1871,7 +1871,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
/// primary-expression
/// postfix-expression '[' expression ']'
/// postfix-expression '[' braced-init-list ']'
/// postfix-expression '[' expression-list [opt] ']' [C++2b 12.4.5]
/// postfix-expression '[' expression-list [opt] ']' [C++23 12.4.5]
/// postfix-expression '(' argument-expression-list[opt] ')'
/// postfix-expression '.' identifier
/// postfix-expression '->' identifier
@ -1946,10 +1946,10 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
// We try to parse a list of indexes in all language mode first
// and, in we find 0 or one index, we try to parse an OpenMP array
// section. This allow us to support C++2b multi dimensional subscript and
// section. This allow us to support C++23 multi dimensional subscript and
// OpenMp sections in the same language mode.
if (!getLangOpts().OpenMP || Tok.isNot(tok::colon)) {
if (!getLangOpts().CPlusPlus2b) {
if (!getLangOpts().CPlusPlus23) {
ExprResult Idx;
if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);

View File

@ -725,7 +725,7 @@ ExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) {
/// '&' identifier initializer
///
/// lambda-declarator:
/// lambda-specifiers [C++2b]
/// lambda-specifiers [C++23]
/// '(' parameter-declaration-clause ')' lambda-specifiers
/// requires-clause[opt]
///
@ -1205,7 +1205,7 @@ static void tryConsumeLambdaSpecifierToken(Parser &P,
static void addStaticToLambdaDeclSpecifier(Parser &P, SourceLocation StaticLoc,
DeclSpec &DS) {
if (StaticLoc.isValid()) {
P.Diag(StaticLoc, !P.getLangOpts().CPlusPlus2b
P.Diag(StaticLoc, !P.getLangOpts().CPlusPlus23
? diag::err_static_lambda
: diag::warn_cxx20_compat_static_lambda);
const char *PrevSpec = nullptr;
@ -1362,7 +1362,7 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
// or operator template declaration. We accept this as a conforming extension
// in all language modes that support lambdas.
if (isCXX11AttributeSpecifier()) {
Diag(Tok, getLangOpts().CPlusPlus2b
Diag(Tok, getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_decl_attrs_on_lambda
: diag::ext_decl_attrs_on_lambda);
MaybeParseCXX11Attributes(D);
@ -1501,7 +1501,7 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
tok::kw_requires, tok::kw_noexcept) ||
(Tok.is(tok::l_square) && NextToken().is(tok::l_square));
if (HasSpecifiers && !HasParentheses && !getLangOpts().CPlusPlus2b) {
if (HasSpecifiers && !HasParentheses && !getLangOpts().CPlusPlus23) {
// It's common to forget that one needs '()' before 'mutable', an
// attribute specifier, the result type, or the requires clause. Deal with
// this.
@ -1996,7 +1996,7 @@ Parser::ParseAliasDeclarationInInitStatement(DeclaratorContext Context,
if (!DG)
return DG;
Diag(DeclStart, !getLangOpts().CPlusPlus2b
Diag(DeclStart, !getLangOpts().CPlusPlus23
? diag::ext_alias_in_init_statement
: diag::warn_cxx20_alias_in_init_statement)
<< SourceRange(DeclStart, DeclEnd);

View File

@ -1053,7 +1053,7 @@ void Parser::ParseCompoundStatementLeadingPragmas() {
void Parser::DiagnoseLabelAtEndOfCompoundStatement() {
if (getLangOpts().CPlusPlus) {
Diag(Tok, getLangOpts().CPlusPlus2b
Diag(Tok, getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_label_end_of_compound_statement
: diag::ext_cxx_label_end_of_compound_statement);
} else {
@ -1457,7 +1457,7 @@ StmtResult Parser::ParseIfStatement(SourceLocation *TrailingElseLoc) {
}
if (Tok.is(tok::kw_consteval)) {
Diag(Tok, getLangOpts().CPlusPlus2b ? diag::warn_cxx20_compat_consteval_if
Diag(Tok, getLangOpts().CPlusPlus23 ? diag::warn_cxx20_compat_consteval_if
: diag::ext_consteval_if);
IsConsteval = true;
ConstevalLoc = ConsumeToken();
@ -1929,7 +1929,7 @@ bool Parser::isForRangeIdentifier() {
/// [C++] for-init-statement:
/// [C++] expression-statement
/// [C++] simple-declaration
/// [C++2b] alias-declaration
/// [C++23] alias-declaration
///
/// [C++0x] for-range-declaration:
/// [C++0x] attribute-specifier-seq[opt] type-specifier-seq declarator

View File

@ -2169,7 +2169,7 @@ static void checkEscapingByref(VarDecl *VD, Sema &S) {
new (S.Context) DeclRefExpr(S.Context, VD, false, T, VK_LValue, Loc);
ExprResult Result;
auto IE = InitializedEntity::InitializeBlock(Loc, T);
if (S.getLangOpts().CPlusPlus2b) {
if (S.getLangOpts().CPlusPlus23) {
auto *E = ImplicitCastExpr::Create(S.Context, T, CK_NoOp, VarRef, nullptr,
VK_XValue, FPOptionsOverride());
Result = S.PerformCopyInitialization(IE, SourceLocation(), E);

View File

@ -762,7 +762,7 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D,
// C++20 [dcl.dcl]/8:
// If decl-specifier-seq contains any decl-specifier other than static,
// thread_local, auto, or cv-qualifiers, the program is ill-formed.
// C++2b [dcl.pre]/6:
// C++23 [dcl.pre]/6:
// Each decl-specifier in the decl-specifier-seq shall be static,
// thread_local, auto (9.2.9.6 [dcl.spec.auto]), or a cv-qualifier.
auto &DS = D.getDeclSpec();
@ -1928,16 +1928,16 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
if (VD->isStaticLocal()) {
if (Kind == Sema::CheckConstexprKind::Diagnose) {
SemaRef.Diag(VD->getLocation(),
SemaRef.getLangOpts().CPlusPlus2b
SemaRef.getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_constexpr_var
: diag::ext_constexpr_static_var)
<< isa<CXXConstructorDecl>(Dcl)
<< (VD->getTLSKind() == VarDecl::TLS_Dynamic);
} else if (!SemaRef.getLangOpts().CPlusPlus2b) {
} else if (!SemaRef.getLangOpts().CPlusPlus23) {
return false;
}
}
if (SemaRef.LangOpts.CPlusPlus2b) {
if (SemaRef.LangOpts.CPlusPlus23) {
CheckLiteralType(SemaRef, Kind, VD->getLocation(), VD->getType(),
diag::warn_cxx20_compat_constexpr_var,
isa<CXXConstructorDecl>(Dcl),
@ -2276,15 +2276,15 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
if (Kind == Sema::CheckConstexprKind::CheckValid) {
// If this is only valid as an extension, report that we don't satisfy the
// constraints of the current language.
if ((Cxx2bLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus2b) ||
if ((Cxx2bLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus23) ||
(Cxx2aLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus20) ||
(Cxx1yLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus17))
return false;
} else if (Cxx2bLoc.isValid()) {
SemaRef.Diag(Cxx2bLoc,
SemaRef.getLangOpts().CPlusPlus2b
SemaRef.getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_constexpr_body_invalid_stmt
: diag::ext_constexpr_body_invalid_stmt_cxx2b)
: diag::ext_constexpr_body_invalid_stmt_cxx23)
<< isa<CXXConstructorDecl>(Dcl);
} else if (Cxx2aLoc.isValid()) {
SemaRef.Diag(Cxx2aLoc,
@ -15976,7 +15976,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
if (MethodDecl->isStatic()) {
if (Op == OO_Call || Op == OO_Subscript)
Diag(FnDecl->getLocation(),
(LangOpts.CPlusPlus2b
(LangOpts.CPlusPlus23
? diag::warn_cxx20_compat_operator_overload_static
: diag::ext_operator_overload_static))
<< FnDecl;
@ -16017,7 +16017,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
}
if (FirstDefaultedParam) {
if (Op == OO_Subscript) {
Diag(FnDecl->getLocation(), LangOpts.CPlusPlus2b
Diag(FnDecl->getLocation(), LangOpts.CPlusPlus23
? diag::ext_subscript_overload
: diag::error_subscript_overload)
<< FnDecl->getDeclName() << 1
@ -16068,7 +16068,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
}
if (Op == OO_Subscript && NumParams != 2) {
Diag(FnDecl->getLocation(), LangOpts.CPlusPlus2b
Diag(FnDecl->getLocation(), LangOpts.CPlusPlus23
? diag::ext_subscript_overload
: diag::error_subscript_overload)
<< FnDecl->getDeclName() << (NumParams == 1 ? 0 : 2);

View File

@ -3957,13 +3957,13 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
} else {
QualType Ty;
// 'z/uz' literals are a C++2b feature.
// 'z/uz' literals are a C++23 feature.
if (Literal.isSizeT)
Diag(Tok.getLocation(), getLangOpts().CPlusPlus
? getLangOpts().CPlusPlus2b
? getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_size_t_suffix
: diag::ext_cxx2b_size_t_suffix
: diag::err_cxx2b_size_t_suffix);
: diag::ext_cxx23_size_t_suffix
: diag::err_cxx23_size_t_suffix);
// 'wb/uwb' literals are a C2x feature. We support _BitInt as a type in C++,
// but we do not currently support the suffix in C++ mode because it's not
@ -4043,7 +4043,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
Ty = Context.getBitIntType(Literal.isUnsigned, Width);
}
// Check C++2b size_t literals.
// Check C++23 size_t literals.
if (Literal.isSizeT) {
assert(!Literal.MicrosoftInteger &&
"size_t literals can't be Microsoft literals");

View File

@ -1467,10 +1467,10 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
: InitializationKind::CreateValue(TyBeginLoc, LParenOrBraceLoc,
RParenOrBraceLoc);
// C++1z [expr.type.conv]p1:
// C++17 [expr.type.conv]p1:
// If the type is a placeholder for a deduced class type, [...perform class
// template argument deduction...]
// C++2b:
// C++23:
// Otherwise, if the type contains a placeholder type, it is replaced by the
// type determined by placeholder type deduction.
DeducedType *Deduced = Ty->getContainedDeducedType();
@ -1497,7 +1497,7 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
diag::err_auto_expr_init_multiple_expressions)
<< Ty << FullRange);
}
if (getLangOpts().CPlusPlus2b) {
if (getLangOpts().CPlusPlus23) {
if (Ty->getAs<AutoType>())
Diag(TyBeginLoc, diag::warn_cxx20_compat_auto_expr) << FullRange;
}
@ -4022,7 +4022,7 @@ ExprResult Sema::CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr) {
// The value of a condition that is an expression is the value of the
// expression, implicitly converted to bool.
//
// C++2b 8.5.2p2
// C++23 8.5.2p2
// If the if statement is of the form if constexpr, the value of the condition
// is contextually converted to bool and the converted expression shall be
// a constant expression.

View File

@ -255,7 +255,7 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc,
}
}
// C++2b [module.unit]p1: ... The identifiers module and import shall not
// C++23 [module.unit]p1: ... The identifiers module and import shall not
// appear as identifiers in a module-name or module-partition. All
// module-names either beginning with an identifier consisting of std
// followed by zero or more digits or containing a reserved identifier

View File

@ -9929,7 +9929,7 @@ bool clang::isBetterOverloadCandidate(
}
}
// C++ [over.match.best]p1: (Changed in C++2b)
// C++ [over.match.best]p1: (Changed in C++23)
//
// -- if F is a static member function, ICS1(F) is defined such
// that ICS1(F) is neither better nor worse than ICS1(G) for
@ -15099,7 +15099,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
bool IsError = false;
// Initialize the implicit object parameter if needed.
// Since C++2b, this could also be a call to a static call operator
// Since C++23, this could also be a call to a static call operator
// which we emit as a regular CallExpr.
if (Method->isInstance()) {
ExprResult ObjRes = PerformObjectArgumentInitialization(

View File

@ -3364,7 +3364,7 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) {
/// might be modified by the implementation.
///
/// \param Mode Overrides detection of current language mode
/// and uses the rules for C++2b.
/// and uses the rules for C++23.
///
/// \returns An aggregate which contains the Candidate and isMoveEligible
/// and isCopyElidable methods. If Candidate is non-null, it means
@ -3385,7 +3385,7 @@ Sema::NamedReturnInfo Sema::getNamedReturnInfo(Expr *&E,
if (Res.Candidate && !E->isXValue() &&
(Mode == SimplerImplicitMoveMode::ForceOn ||
(Mode != SimplerImplicitMoveMode::ForceOff &&
getLangOpts().CPlusPlus2b))) {
getLangOpts().CPlusPlus23))) {
E = ImplicitCastExpr::Create(Context, VD->getType().getNonReferenceType(),
CK_NoOp, E, nullptr, VK_XValue,
FPOptionsOverride());
@ -3529,7 +3529,7 @@ ExprResult Sema::PerformMoveOrCopyInitialization(
const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value,
bool SupressSimplerImplicitMoves) {
if (getLangOpts().CPlusPlus &&
(!getLangOpts().CPlusPlus2b || SupressSimplerImplicitMoves) &&
(!getLangOpts().CPlusPlus23 || SupressSimplerImplicitMoves) &&
NRInfo.isMoveEligible()) {
ImplicitCastExpr AsRvalue(ImplicitCastExpr::OnStack, Value->getType(),
CK_NoOp, Value, VK_XValue, FPOptionsOverride());
@ -3902,7 +3902,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
static bool CheckSimplerImplicitMovesMSVCWorkaround(const Sema &S,
const Expr *E) {
if (!E || !S.getLangOpts().CPlusPlus2b || !S.getLangOpts().MSVCCompat)
if (!E || !S.getLangOpts().CPlusPlus23 || !S.getLangOpts().MSVCCompat)
return false;
const Decl *D = E->getReferencedDeclOfCallee();
if (!D || !S.SourceMgr.isInSystemHeader(D->getLocation()))

View File

@ -3645,7 +3645,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
case DeclaratorContext::FunctionalCast:
if (isa<DeducedTemplateSpecializationType>(Deduced))
break;
if (SemaRef.getLangOpts().CPlusPlus2b && IsCXXAutoType &&
if (SemaRef.getLangOpts().CPlusPlus23 && IsCXXAutoType &&
!Auto->isDecltypeAuto())
break; // auto(x)
[[fallthrough]];

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -fexperimental-new-constant-interpreter %s -verify
// RUN: %clang_cc1 -std=c++2b -fsyntax-only %s -verify=ref
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fexperimental-new-constant-interpreter %s -verify
// RUN: %clang_cc1 -std=c++23 -fsyntax-only %s -verify=ref
// expected-no-diagnostics
// ref-no-diagnostics

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++2b -ast-dump=json %s | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++23 -ast-dump=json %s | FileCheck %s
void func(int val) {
if (val)

View File

@ -1,10 +1,10 @@
// Test without serialization:
// RUN: %clang_cc1 -std=c++2b -triple x86_64-linux-gnu -fcxx-exceptions -ast-dump %s \
// RUN: %clang_cc1 -std=c++23 -triple x86_64-linux-gnu -fcxx-exceptions -ast-dump %s \
// RUN: | FileCheck -strict-whitespace %s
//
// Test with serialization:
// RUN: %clang_cc1 -std=c++2b -triple x86_64-linux-gnu -fcxx-exceptions -emit-pch -o %t %s
// RUN: %clang_cc1 -x c++ -std=c++2b -triple x86_64-linux-gnu -fcxx-exceptions -include-pch %t -ast-dump-all /dev/null \
// RUN: %clang_cc1 -std=c++23 -triple x86_64-linux-gnu -fcxx-exceptions -emit-pch -o %t %s
// RUN: %clang_cc1 -x c++ -std=c++23 -triple x86_64-linux-gnu -fcxx-exceptions -include-pch %t -ast-dump-all /dev/null \
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
// RUN: | FileCheck -strict-whitespace %s

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -fcxx-exceptions -verify=expected,cxx11_2b,cxx2b %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify=expected,cxx98_20,cxx11_2b,cxx11_20 %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify=expected,cxx98_20,cxx11_2b,cxx11_20 %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fcxx-exceptions -verify=expected,cxx11_23,cxx23 %s
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify=expected,cxx98_20,cxx11_23,cxx11_20 %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify=expected,cxx98_20,cxx11_23,cxx11_20 %s
// RUN: %clang_cc1 -std=c++98 -fsyntax-only -fcxx-exceptions -Wno-c++11-extensions -verify=expected,cxx98_20,cxx98 %s
namespace test_delete_function {
@ -98,7 +98,7 @@ struct A1 {
A1(const A1 &);
A1(A1 &&) = delete;
// expected-note@-1 2{{'A1' has been explicitly marked deleted here}}
// cxx11_2b-note@-2 3{{'A1' has been explicitly marked deleted here}}
// cxx11_23-note@-2 3{{'A1' has been explicitly marked deleted here}}
};
void test1() {
try {
@ -208,7 +208,7 @@ struct NeedRvalueRef {
struct NeedValue {
NeedValue(A1); // cxx98-note 2 {{passing argument to parameter here}}
NeedValue(A2);
NeedValue(B1); // cxx11_2b-note 2 {{passing argument to parameter here}}
NeedValue(B1); // cxx11_23-note 2 {{passing argument to parameter here}}
NeedValue(B2);
};
@ -267,14 +267,14 @@ NeedValue test_2_3() {
struct B1 {
B1();
B1(const B1 &);
B1(B1 &&) = delete; // cxx11_2b-note 3 {{'B1' has been explicitly marked deleted here}}
B1(B1 &&) = delete; // cxx11_23-note 3 {{'B1' has been explicitly marked deleted here}}
// cxx98-note@-1 {{'B1' has been explicitly marked deleted here}}
};
NeedValue test_3_1() {
// not rvalue reference
// same type
B1 b;
return b; // cxx11_2b-error {{call to deleted constructor of 'B1'}}
return b; // cxx11_23-error {{call to deleted constructor of 'B1'}}
}
class DerivedB1 : public B1 {};
B1 test_3_2() {
@ -287,7 +287,7 @@ NeedValue test_3_3() {
// not rvalue reference
// not same type
DerivedB1 b;
return b; // cxx11_2b-error {{call to deleted constructor of 'B1'}}
return b; // cxx11_23-error {{call to deleted constructor of 'B1'}}
}
struct B2 {
@ -295,14 +295,14 @@ struct B2 {
B2(const B2 &);
private:
B2(B2 &&); // cxx11_2b-note 3 {{declared private here}}
B2(B2 &&); // cxx11_23-note 3 {{declared private here}}
// cxx98-note@-1 {{declared private here}}
};
NeedValue test_4_1() {
// not rvalue reference
// same type
B2 b;
return b; // cxx11_2b-error {{calling a private constructor of class 'test_ctor_param_rvalue_ref::B2'}}
return b; // cxx11_23-error {{calling a private constructor of class 'test_ctor_param_rvalue_ref::B2'}}
}
class DerivedB2 : public B2 {};
B2 test_4_2() {
@ -315,7 +315,7 @@ NeedValue test_4_3() {
// not rvalue reference
// not same type
DerivedB2 b;
return b; // cxx11_2b-error {{calling a private constructor of class 'test_ctor_param_rvalue_ref::B2'}}
return b; // cxx11_23-error {{calling a private constructor of class 'test_ctor_param_rvalue_ref::B2'}}
}
} // namespace test_ctor_param_rvalue_ref
@ -323,7 +323,7 @@ namespace test_lvalue_ref_is_not_moved_from {
struct Target {};
// expected-note@-1 {{candidate constructor (the implicit copy constructor) not viable}}
// cxx11_2b-note@-2 {{candidate constructor (the implicit move constructor) not viable}}
// cxx11_23-note@-2 {{candidate constructor (the implicit move constructor) not viable}}
struct CopyOnly {
CopyOnly(CopyOnly &&) = delete; // expected-note {{has been explicitly marked deleted here}}
@ -333,7 +333,7 @@ struct CopyOnly {
};
struct MoveOnly {
MoveOnly(MoveOnly &&); // cxx11_2b-note {{copy constructor is implicitly deleted because}}
MoveOnly(MoveOnly &&); // cxx11_23-note {{copy constructor is implicitly deleted because}}
operator Target() &&; // expected-note {{candidate function not viable}}
};
@ -352,7 +352,7 @@ CopyOnly t2() {
MoveOnly t3() {
MoveOnly& r = moveonly;
return r; // cxx11_2b-error {{call to implicitly-deleted copy constructor}}
return r; // cxx11_23-error {{call to implicitly-deleted copy constructor}}
}
MoveOnly t4() {
@ -437,11 +437,11 @@ ConstCopyOnly t1() {
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}}
};
NonConstCopyOnly t2() {
NonConstCopyOnly x;
return x; // cxx11_2b-error {{call to deleted constructor}}
return x; // cxx11_23-error {{call to deleted constructor}}
}
} // namespace test_constandnonconstcopy
@ -469,10 +469,10 @@ C test2(D x) { return x; } // expected-error {{invokes a deleted function}}
namespace test_simpler_implicit_move {
struct CopyOnly {
CopyOnly(); // cxx2b-note {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
// cxx2b-note@-1 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
CopyOnly(CopyOnly &); // cxx2b-note {{candidate constructor not viable: expects an lvalue for 1st argument}}
// cxx2b-note@-1 {{candidate constructor not viable: expects an lvalue for 1st argument}}
CopyOnly(); // cxx23-note {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
// cxx23-note@-1 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
CopyOnly(CopyOnly &); // cxx23-note {{candidate constructor not viable: expects an lvalue for 1st argument}}
// cxx23-note@-1 {{candidate constructor not viable: expects an lvalue for 1st argument}}
};
struct MoveOnly {
MoveOnly();
@ -490,7 +490,7 @@ CopyOnly test2(bool b) {
if (b) {
return w1;
} else {
return w2; // cxx2b-error {{no matching constructor for initialization}}
return w2; // cxx23-error {{no matching constructor for initialization}}
}
}
@ -505,7 +505,7 @@ MoveOnly &&test4() {
void test5() try {
CopyOnly x;
throw x; // cxx2b-error {{no matching constructor for initialization}}
throw x; // cxx23-error {{no matching constructor for initialization}}
} catch (...) {
}

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2a -verify=expected,cxx2a %s
// RUN: %clang_cc1 -std=c++2b -verify=expected %s
// RUN: %clang_cc1 -std=c++23 -verify=expected %s
// p3: if the function is a constructor or destructor, its class shall not have
// any virtual base classes;
@ -14,13 +14,13 @@ namespace contents {
struct A {
constexpr ~A() {
return;
goto x; // cxx2a-warning {{use of this statement in a constexpr function is a C++2b extension}}
goto x; // cxx2a-warning {{use of this statement in a constexpr function is a C++23 extension}}
x: ;
}
};
struct B {
constexpr ~B() {
x:; // cxx2a-warning {{use of this statement in a constexpr function is a C++2b extension}}
x:; // cxx2a-warning {{use of this statement in a constexpr function is a C++23 extension}}
}
};
struct Nonlit { // cxx2a-note {{'Nonlit' is not literal because}}
@ -29,19 +29,19 @@ namespace contents {
struct C {
constexpr ~C() {
return;
Nonlit nl; // cxx2a-error {{variable of non-literal type 'Nonlit' cannot be defined in a constexpr function before C++2b}}
Nonlit nl; // cxx2a-error {{variable of non-literal type 'Nonlit' cannot be defined in a constexpr function before C++23}}
}
};
struct D {
constexpr ~D() {
return;
static int a; // cxx2a-warning {{definition of a static variable in a constexpr function is a C++2b extension}}
static int a; // cxx2a-warning {{definition of a static variable in a constexpr function is a C++23 extension}}
}
};
struct E {
constexpr ~E() {
return;
thread_local int e; // cxx2a-warning {{definition of a thread_local variable in a constexpr function is a C++2b extension}}
thread_local int e; // cxx2a-warning {{definition of a thread_local variable in a constexpr function is a C++23 extension}}
}
};
struct F {

View File

@ -1,28 +1,28 @@
// RUN: %clang_cc1 -verify -std=c++2b -Wpre-c++2b-compat %s
// RUN: %clang_cc1 -verify -std=c++23 -Wpre-c++23-compat %s
constexpr int h(int n) {
if (!n)
return 0;
static const int m = n; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
static const int m = n; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexpr int i(int n) {
if (!n)
return 0;
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++2b}}
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}}
return m;
}
constexpr int g() { // expected-error {{constexpr function never produces a constant expression}}
goto test; // expected-note {{subexpression not valid in a constant expression}} \
// expected-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++2b}}
// expected-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
test:
return 0;
}
constexpr void h() {
label:; // expected-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++2b}}
label:; // expected-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
}
struct NonLiteral { // expected-note 2 {{'NonLiteral' is not literal}}
@ -31,18 +31,18 @@ struct NonLiteral { // expected-note 2 {{'NonLiteral' is not literal}}
constexpr void non_literal() { // expected-error {{constexpr function never produces a constant expression}}
NonLiteral n; // expected-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}} \
// expected-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++2b}}
// expected-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++23}}
}
constexpr void non_literal2(bool b) {
if (!b)
NonLiteral n; // expected-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++2b}}
NonLiteral n; // expected-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++23}}
}
constexpr int c_thread_local(int n) {
if (!n)
return 0;
static _Thread_local int a; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
static _Thread_local int a; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
_Thread_local int b; // // expected-error {{'_Thread_local' variables must have global storage}}
return 0;
}
@ -50,7 +50,7 @@ constexpr int c_thread_local(int n) {
constexpr int gnu_thread_local(int n) {
if (!n)
return 0;
static __thread int a; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
static __thread int a; // expected-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
__thread int b; // expected-error {{'__thread' variables must have global storage}}
return 0;
}

View File

@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fcxx-exceptions -verify=expected,beforecxx14,beforecxx20,beforecxx2b -std=c++11 %s
// RUN: %clang_cc1 -fcxx-exceptions -verify=expected,aftercxx14,beforecxx20,beforecxx2b -std=c++14 %s
// RUN: %clang_cc1 -fcxx-exceptions -verify=expected,aftercxx14,aftercxx20,beforecxx2b -std=c++20 %s
// RUN: %clang_cc1 -fcxx-exceptions -verify=expected,aftercxx14,aftercxx20 -std=c++2b %s
// RUN: %clang_cc1 -fcxx-exceptions -verify=expected,beforecxx14,beforecxx20,beforecxx23 -std=c++11 %s
// RUN: %clang_cc1 -fcxx-exceptions -verify=expected,aftercxx14,beforecxx20,beforecxx23 -std=c++14 %s
// RUN: %clang_cc1 -fcxx-exceptions -verify=expected,aftercxx14,aftercxx20,beforecxx23 -std=c++20 %s
// RUN: %clang_cc1 -fcxx-exceptions -verify=expected,aftercxx14,aftercxx20 -std=c++23 %s
namespace N {
typedef char C;
@ -124,12 +124,12 @@ constexpr int DisallowedStmtsCXX14_1(bool b) {
constexpr int DisallowedStmtsCXX14_2() {
return 0; // beforecxx14-note {{previous}}
// - a goto statement
goto x; // beforecxx2b-warning {{use of this statement in a constexpr function is a C++2b extension}}
goto x; // beforecxx23-warning {{use of this statement in a constexpr function is a C++23 extension}}
x:;
return 0; // beforecxx14-warning {{multiple return}}
}
constexpr int DisallowedStmtsCXX14_2_1() {
merp: // beforecxx2b-warning {{use of this statement in a constexpr function is a C++2b extension}}
merp: // beforecxx23-warning {{use of this statement in a constexpr function is a C++23 extension}}
return 0;
}
constexpr int DisallowedStmtsCXX14_3() {
@ -141,14 +141,14 @@ constexpr int DisallowedStmtsCXX14_3() {
constexpr int DisallowedStmtsCXX14_4() {
// - a definition of a variable of non-literal type
return 0;
NonLiteral nl; // beforecxx2b-error {{variable of non-literal type 'NonLiteral' cannot be defined in a constexpr function before C++2b}} \
// beforecxx2b-note@14 {{'NonLiteral' is not literal}}
NonLiteral nl; // beforecxx23-error {{variable of non-literal type 'NonLiteral' cannot be defined in a constexpr function before C++23}} \
// beforecxx23-note@14 {{'NonLiteral' is not literal}}
}
constexpr int DisallowedStmtsCXX14_5() {
return 0;
// - a definition of a variable of static storage duration
static constexpr int n = 123; // beforecxx2b-warning {{definition of a static variable in a constexpr function is a C++2b extension}} \
static constexpr int n = 123; // beforecxx23-warning {{definition of a static variable in a constexpr function is a C++23 extension}} \
// beforecxx14-warning {{variable declaration in a constexpr function is a C++14 extension}}
}
@ -156,7 +156,7 @@ constexpr int DisallowedStmtsCXX14_6() {
// - a definition of a variable of thread storage duration
return 0;
thread_local constexpr int n = 123; // beforecxx14-warning {{variable declaration in a constexpr function is a C++14 extension}} \
// beforecxx2b-warning {{definition of a thread_local variable in a constexpr function is a C++2b extension}}
// beforecxx23-warning {{definition of a thread_local variable in a constexpr function is a C++23 extension}}
}
constexpr int DisallowedStmtsCXX14_7() {
// - a definition of a variable for which no initialization is performed
@ -262,7 +262,7 @@ namespace std_example {
}
constexpr int first(int n) {
return 0;
static int value = n; // beforecxx2b-warning {{definition of a static variable in a constexpr function is a C++2b extension}} \
static int value = n; // beforecxx23-warning {{definition of a static variable in a constexpr function is a C++23 extension}} \
// beforecxx14-warning {{variable declaration in a constexpr function is a C++14 extension}}
}
constexpr int uninit() {

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -std=c++2b -verify=expected,cxx2b %s
// RUN: %clang_cc1 -verify -std=c++23 -verify=expected,cxx23 %s
// RUN: %clang_cc1 -verify -std=c++20 -verify=expected,cxx14_20 %s
// RUN: %clang_cc1 -verify -std=c++14 -verify=expected,cxx14_20 %s
@ -30,7 +30,7 @@ using Int = decltype(x3d);
auto x4a = (i);
decltype(auto) x4d = (i);
using Int = decltype(x4a);
using IntLRef = decltype(x4d); // cxx2b-note {{previous definition is here}}
using IntLRef = decltype(x4d); // cxx23-note {{previous definition is here}}
auto x5a = f();
decltype(auto) x5d = f();
@ -81,7 +81,7 @@ using Int = decltype(f2d(0));
auto f3a(int n) { return (n); }
decltype(auto) f3d(int n) { return (n); } // expected-warning {{reference to stack memory}}
using Int = decltype(f3a(0));
using IntLRef = decltype(f3d(0)); // cxx2b-error {{type alias redefinition with different types ('decltype(f3d(0))' (aka 'int &&') vs 'decltype(x4d)' (aka 'int &'))}}
using IntLRef = decltype(f3d(0)); // cxx23-error {{type alias redefinition with different types ('decltype(f3d(0))' (aka 'int &&') vs 'decltype(x4d)' (aka 'int &'))}}
auto f4a(int n) { return f(); }
decltype(auto) f4d(int n) { return f(); }

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -verify %s
// RUN: %clang_cc1 -std=c++23 -verify %s
// p2.3 allows only T = auto in T(x).

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
namespace dr1 { // dr1: no
namespace X { extern "C" void dr1_f(int a = 1); }

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
namespace std {
__extension__ typedef __SIZE_TYPE__ size_t;

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// dr1200: na

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
#if __cplusplus < 201103L
// expected-error@+1 {{variadic macro}}

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
namespace dr100 { // dr100: yes
template<const char (*)[4]> struct A {}; // expected-note 0-1{{declared here}}

View File

@ -4,7 +4,7 @@
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
#if __cplusplus < 201103L
#define static_assert(...) _Static_assert(__VA_ARGS__)

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
#if __cplusplus < 201103L
// expected-error@+1 {{variadic macro}}

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
#if __cplusplus >= 201103L
namespace dr2303 { // dr2303: 12

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// PR13819 -- __SIZE_TYPE__ is incompatible.
typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2b -verify=expected,cxx20_2b,cxx2b -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 -verify=expected,cxx98_20,cxx20_2b -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 -verify=expected,cxx20_23,cxx23 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 -verify=expected,cxx98_20,cxx20_23 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 -verify=expected,cxx98_17,cxx98_20 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++14 -verify=expected,cxx98_17,cxx98_20 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 -verify=expected,cxx98_17,cxx98_20 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors
@ -20,8 +20,8 @@ namespace dr301 { // dr301: yes
void f() {
bool a = (void(*)(S, S))operator+<S> < // expected-warning {{ordered comparison of function pointers}}
(void(*)(S, S))operator+<S>;
bool b = (void(*)(S, S))operator- < // cxx20_2b-note {{to match this '<'}} cxx98_17-warning {{ordered comparison of function pointers}}
(void(*)(S, S))operator-; // cxx20_2b-error {{expected '>'}}
bool b = (void(*)(S, S))operator- < // cxx20_23-note {{to match this '<'}} cxx98_17-warning {{ordered comparison of function pointers}}
(void(*)(S, S))operator-; // cxx20_23-error {{expected '>'}}
bool c = (void(*)(S, S))operator+ < // expected-note {{to match this '<'}}
(void(*)(S, S))operator-; // expected-error {{expected '>'}}
}
@ -459,10 +459,10 @@ namespace dr331 { // dr331: yes
namespace dr332 { // dr332: dup 577
void f(volatile void); // expected-error {{'void' as parameter must not have type qualifiers}}
// cxx20_2b-warning@-1 {{volatile-qualified parameter type 'volatile void' is deprecated}}
// cxx20_23-warning@-1 {{volatile-qualified parameter type 'volatile void' is deprecated}}
void g(const void); // expected-error {{'void' as parameter must not have type qualifiers}}
void h(int n, volatile void); // expected-error {{'void' must be the first and only parameter}}
// cxx20_2b-warning@-1 {{volatile-qualified parameter type 'volatile void' is deprecated}}
// cxx20_23-warning@-1 {{volatile-qualified parameter type 'volatile void' is deprecated}}
}
namespace dr333 { // dr333: yes
@ -647,7 +647,7 @@ namespace dr349 { // dr349: no
template <class T> operator T ***() {
int ***p = 0;
return p; // cxx98_20-error {{cannot initialize return object of type 'const int ***' with an lvalue of type 'int ***'}}
// cxx2b-error@-1 {{cannot initialize return object of type 'const int ***' with an rvalue of type 'int ***'}}
// cxx23-error@-1 {{cannot initialize return object of type 'const int ***' with an rvalue of type 'int ***'}}
}
};
@ -961,12 +961,12 @@ namespace dr368 { // dr368: yes
template<typename T, T> struct S {}; // expected-note {{here}}
template<typename T> int f(S<T, T()> *); // expected-error {{function type}}
template<typename T> int g(S<T, (T())> *); // cxx98_17-note {{type 'X'}}
// cxx20_2b-note@-1 {{candidate function [with T = dr368::X]}}
// cxx20_23-note@-1 {{candidate function [with T = dr368::X]}}
template<typename T> int g(S<T, true ? T() : T()> *); // cxx98_17-note {{type 'X'}}
// cxx20_2b-note@-1 {{candidate function [with T = dr368::X]}}
// cxx20_23-note@-1 {{candidate function [with T = dr368::X]}}
struct X {};
int n = g<X>(0); // cxx98_17-error {{no matching}}
// cxx20_2b-error@-1 {{call to 'g' is ambiguous}}
// cxx20_23-error@-1 {{call to 'g' is ambiguous}}
}
// dr370: na

View File

@ -3,7 +3,7 @@
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.
__extension__ typedef __SIZE_TYPE__ size_t;

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// FIXME: This is included to avoid a diagnostic with no source location
// pointing at the implicit operator new. We can't match such a diagnostic

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking
// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking
// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking
// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking
namespace dr600 { // dr600: yes
struct S {

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
namespace std {
__extension__ typedef __SIZE_TYPE__ size_t;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -verify %s
// RUN: %clang_cc1 -std=c++23 -verify %s
template <class T>
void foo(T);
@ -9,7 +9,7 @@ struct A {
float g(double);
} a{1};
// C++2b [dcl.type.auto.deduct]p2.3
// C++23 [dcl.type.auto.deduct]p2.3
// For an explicit type conversion, T is the specified type, which shall be auto.
void diagnostics() {
foo(auto()); // expected-error {{initializer for functional-style cast to 'auto' is empty}}

View File

@ -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,cxx14_20 %s
// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=expected,cxx14_20 %s
@ -9,7 +9,7 @@ int &d = [] (int &r) -> auto & { return r; } (a);
int &e = [] (int &r) -> auto { return r; } (a); // expected-error {{cannot bind to a temporary}}
int &f = [] (int r) -> decltype(auto) { return r; } (a); // expected-error {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
int &g = [] (int r) -> decltype(auto) { return (r); } (a); // expected-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'}}
int test_explicit_auto_return()
{
@ -17,7 +17,7 @@ int test_explicit_auto_return()
auto L = [](auto F, auto a) { return F(a); };
auto M = [](auto a) -> auto { return a; }; // OK
auto MRef = [](auto b) -> auto & { return b; }; //cxx14_20-warning{{reference to stack}}
// cxx2b-error@-1 {{non-const lvalue reference to type 'X' cannot bind to a temporary of type 'X'}}
// cxx23-error@-1 {{non-const lvalue reference to type 'X' cannot bind to a temporary of type 'X'}}
auto MPtr = [](auto c) -> auto* { return &c; }; //expected-warning{{address of stack}}
auto MDeclType = [](auto&& d) -> decltype(auto) { return static_cast<decltype(d)>(d); }; //OK
M(3);
@ -57,7 +57,7 @@ int test_no_parameter_list()
auto M = [] { return 5; }; // OK
auto M2 = [] -> auto && { return si; };
#if __cplusplus <= 202002L
// expected-warning@-2{{is a C++2b extension}}
// expected-warning@-2{{is a C++23 extension}}
#endif
M();
}

View File

@ -2,7 +2,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -pedantic
// [expr.new]p2 ... the invented declaration: T x init ;
// C++2b [dcl.type.auto.deduct]p2.2
// C++23 [dcl.type.auto.deduct]p2.2
// For a variable declared with a type that contains a placeholder type, T is the declared type of the variable.
void f() {
// - If the initializer is a parenthesized expression-list, the expression-list shall be a single assignmentexpression and E is the assignment-expression.

View File

@ -1,9 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify=cxx2b -std=c++2b %s
// RUN: %clang_cc1 -fsyntax-only -verify=cxx23 -std=c++23 %s
// RUN: %clang_cc1 -fsyntax-only -verify=cxx20 -std=c++20 %s
// cxx2b-no-diagnostics
// cxx23-no-diagnostics
struct __unique {
static constexpr auto operator()() { return 4; }; // cxx20-warning {{is a C++2b extension}}
static constexpr auto operator()() { return 4; }; // cxx20-warning {{is a C++23 extension}}
using P = int();
constexpr operator P*() { return operator(); }

View File

@ -1,15 +1,15 @@
// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx11
// RUN: %clang_cc1 -std=c++2b %s -verify=expected,cxx2b
// RUN: %clang_cc1 -std=c++2b -Wpre-c++2b-compat %s -verify=expected,precxx2b
// RUN: %clang_cc1 -std=c++23 %s -verify=expected,cxx23
// RUN: %clang_cc1 -std=c++23 -Wpre-c++23-compat %s -verify=expected,precxx23
struct Functor {
static int operator()(int a, int b);
static int operator[](int a1);
// cxx11-warning@-2 {{declaring overloaded 'operator()' as 'static' is a C++2b extension}}
// cxx11-warning@-2 {{declaring overloaded 'operator[]' as 'static' is a C++2b extension}}
// precxx2b-warning@-4 {{incompatible with C++ standards before C++2b}}
// precxx2b-warning@-4 {{incompatible with C++ standards before C++2b}}
// cxx11-warning@-2 {{declaring overloaded 'operator()' as 'static' is a C++23 extension}}
// cxx11-warning@-2 {{declaring overloaded 'operator[]' as 'static' is a C++23 extension}}
// precxx23-warning@-4 {{incompatible with C++ standards before C++23}}
// precxx23-warning@-4 {{incompatible with C++ standards before C++23}}
};
struct InvalidParsing1 {

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++2b -fsyntax-only -verify %s
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++23 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++20 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fsyntax-only -verify %s
class X {

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -verify %s
// RUN: %clang_cc1 -std=c++23 -verify %s
void test_consteval() {
if consteval ({(void)1;}); // expected-error {{expected { after consteval}}

View File

@ -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,cxx98_20 %s
// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify=expected,cxx98_20 %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx98_20 %s
@ -69,8 +69,8 @@ struct X0 {
T x = T();
return x; // cxx98_20-error{{cannot initialize return object of type 'const char *' with an lvalue of type 'char'}} \
// cxx98_20-error{{cannot initialize return object of type 'const int *' with an lvalue of type 'int'}} \
// cxx2b-error{{cannot initialize return object of type 'const char *' with an rvalue of type 'char'}} \
// cxx2b-error{{cannot initialize return object of type 'const int *' with an rvalue of type 'int'}}
// cxx23-error{{cannot initialize return object of type 'const char *' with an rvalue of type 'char'}} \
// cxx23-error{{cannot initialize return object of type 'const int *' with an rvalue of type 'int'}}
}
};

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fblocks -fms-extensions -fsyntax-only -verify=expected,cxx11 %s
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++2b -fblocks -fms-extensions -fsyntax-only -verify=expected %s
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++23 -fblocks -fms-extensions -fsyntax-only -verify=expected %s
template<typename T, typename U> struct pair;
template<typename ...> struct tuple;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -std=c++23 %s -emit-llvm -o - | FileCheck %s
void should_be_used_1();
void should_be_used_2();

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2b %s -emit-llvm -triple x86_64-linux -o - | FileCheck %s
// RUN: %clang_cc1 -std=c++2b %s -emit-llvm -triple x86_64-windows-msvc -o - | FileCheck %s
// RUN: %clang_cc1 -std=c++23 %s -emit-llvm -triple x86_64-linux -o - | FileCheck %s
// RUN: %clang_cc1 -std=c++23 %s -emit-llvm -triple x86_64-windows-msvc -o - | FileCheck %s
struct Functor {
static int operator()(int x, int y) {

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2b %s -emit-llvm -triple x86_64-linux -o - | FileCheck %s
// RUN: %clang_cc1 -std=c++2b %s -emit-llvm -triple x86_64-windows-msvc -o - | FileCheck %s
// RUN: %clang_cc1 -std=c++23 %s -emit-llvm -triple x86_64-linux -o - | FileCheck %s
// RUN: %clang_cc1 -std=c++23 %s -emit-llvm -triple x86_64-windows-msvc -o - | FileCheck %s
struct Functor {
static int operator[](int x, int y) {

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fms-extensions -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++2b -triple %itanium_abi_triple -main-file-name if.cpp %s | FileCheck %s
// RUN: %clang_cc1 -fms-extensions -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++23 -triple %itanium_abi_triple -main-file-name if.cpp %s | FileCheck %s
int nop() { return 0; }
struct S {

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++2b -triple %itanium_abi_triple -main-file-name if.cpp %s
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++23 -triple %itanium_abi_triple -main-file-name if.cpp %s
// No crash for following example.
// See https://github.com/llvm/llvm-project/issues/45481

View File

@ -604,7 +604,7 @@
// STDCXX20: -std=c++20
// RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s
// STDCXXLATEST: -std=c++2b
// STDCXXLATEST: -std=c++23
// RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
// ENV-CL: "-ffunction-sections"

View File

@ -1,6 +1,6 @@
// RUN: %clang -std=c++2a -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
// RUN: %clang -std=c++20 -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
// RUN: %clang -std=c++2b -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
// RUN: %clang -std=c++23 -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
// RUN: %clang -std=c++latest -fprebuilt-module-path=. -### -c %s 2>&1 | FileCheck %s
//
// CHECK-NOT: warning: argument unused during compilation

View File

@ -11,8 +11,8 @@
// RUN: not %clang -std=gnu++1z %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX1Z %s
// RUN: not %clang -std=c++2a %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX2A %s
// RUN: not %clang -std=gnu++2a %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX2A %s
// RUN: not %clang -std=c++2b %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX2B %s
// RUN: not %clang -std=gnu++2b %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX2B %s
// RUN: not %clang -std=c++23 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX2B %s
// RUN: not %clang -std=gnu++23 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX2B %s
void f(int n) {
typeof(n)();

View File

@ -17,8 +17,8 @@
// CHECK-NEXT: note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
// CHECK-NEXT: note: use 'c++20' for 'ISO C++ 2020 DIS' standard
// CHECK-NEXT: note: use 'gnu++20' for 'ISO C++ 2020 DIS with GNU extensions' standard
// CHECK-NEXT: note: use 'c++2b' for 'Working draft for ISO C++ 2023 DIS' standard
// CHECK-NEXT: note: use 'gnu++2b' for 'Working draft for ISO C++ 2023 DIS with GNU extensions' standard
// CHECK-NEXT: note: use 'c++23' for 'ISO C++ 2023 DIS' standard
// CHECK-NEXT: note: use 'gnu++23' for 'ISO C++ 2023 DIS with GNU extensions' standard
// CUDA-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard
// Make sure that no other output is present.

View File

@ -59,8 +59,8 @@ void S2::f(int i) {
(void)[] mutable {};
(void)[]->int{};
#if __cplusplus <= 202002L
// expected-warning@-3{{is a C++2b extension}}
// expected-warning@-3{{is a C++2b extension}}
// expected-warning@-3{{is a C++23 extension}}
// expected-warning@-3{{is a C++23 extension}}
#endif
delete []() { return new int; }(); // expected-error{{'[]' after delete interpreted as 'delete[]'}}

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -x c++ -std=gnu++11 -fsyntax-only -pedantic -verify=ext,expected %s
// RUN: %clang_cc1 -x c -std=gnu11 -fsyntax-only -pedantic -verify=ext,expected %s
// RUN: %clang_cc1 -x c++ -std=c++2b -fsyntax-only -pedantic -verify=cxx2b,expected -Wpre-c++2b-compat %s
// RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only -pedantic -verify=cxx23,expected -Wpre-c++23-compat %s
// RUN: %clang_cc1 -x c++ -std=gnu++11 -fwchar-type=short -fno-signed-wchar -fsyntax-only -pedantic -verify=ext,expected %s
// RUN: %clang_cc1 -x c -std=gnu11 -fwchar-type=short -fno-signed-wchar -fsyntax-only -pedantic -verify=ext,expected %s
// RUN: %clang_cc1 -x c++ -std=c++17 -ftrigraphs -fsyntax-only -pedantic -verify=ext,expected -DTRIGRAPHS=1 %s
@ -21,47 +21,47 @@ const char *errors =
void ucn(void) {
char a = '\u{1234}'; // expected-error {{character too large for enclosing character literal type}} \
// ext-warning {{extension}} cxx2b-warning {{C++2b}}
// ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned b = U'\u{1234}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned b = U'\u{1234}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
#ifdef __cplusplus
unsigned b2 = U'\u{1}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned b2 = U'\u{1}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
#else
unsigned b2 = U'\u{1}'; //expected-error {{universal character name refers to a control character}}
#endif
unsigned c = U'\u{000000000001234}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned c = U'\u{000000000001234}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned d = U'\u{111111111}'; //expected-error {{hex escape sequence out of range}}
}
void hex(void) {
char a = '\x{1}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
char a = '\x{1}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
char b = '\x{abcdegggggabc}'; // expected-error 5{{invalid digit 'g' in escape sequence}}
char c = '\x{ff1}'; // expected-error {{hex escape sequence out of range}}
#if __WCHAR_MAX__ > 0xFFFF
unsigned d = L'\x{FFFFFFFF}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned d = L'\x{FFFFFFFF}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned e = L'\x{100000000}'; // expected-error {{hex escape sequence out of range}}
#else
unsigned f = L'\x{FFFF}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned f = L'\x{FFFF}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned g = L'\x{10000}'; // expected-error {{hex escape sequence out of range}}
#endif
unsigned h = U'\x{FFFFFFFF}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned h = U'\x{FFFFFFFF}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned i = U'\x{100000000}'; // expected-error {{hex escape sequence out of range}}
}
void octal(void) {
char a = '\o{1}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
char a = '\o{1}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
char b = '\o{12345678881238}'; // expected-error 4{{invalid digit '8' in escape sequence}}
char c = '\o{777}'; // //expected-error {{octal escape sequence out of range}}
#if __WCHAR_MAX__ > 0xFFFF
unsigned d = L'\o{37777777777}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned d = L'\o{37777777777}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned e = L'\o{40000000000}'; // expected-error {{octal escape sequence out of range}}
unsigned f = L'\o{100000000000}'; // expected-error {{octal escape sequence out of range}}
unsigned g = L'\o{200000000000}'; // expected-error {{octal escape sequence out of range}}
#else
unsigned d = L'\o{177777}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned d = L'\o{177777}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned e = L'\o{200000}'; // expected-error {{octal escape sequence out of range}}
#endif
}
@ -78,9 +78,9 @@ void concat(void) {
void named(void) {
char a = '\N{LOTUS}'; // expected-error{{character too large for enclosing character literal type}} \
// ext-warning {{extension}} cxx2b-warning {{C++2b}}
// ext-warning {{extension}} cxx23-warning {{C++23}}
char b = '\N{DOLLAR SIGN}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
char b = '\N{DOLLAR SIGN}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
char b_ = '\N{ DOL-LAR _SIGN }'; // expected-error {{' DOL-LAR _SIGN ' is not a valid Unicode character name}} \
// expected-note {{characters names in Unicode escape sequences are sensitive to case and whitespaces}}
@ -89,13 +89,13 @@ void named(void) {
char d = '\N{}'; // expected-error {{delimited escape sequence cannot be empty}}
char e = '\N{'; // expected-error {{incomplete universal character name}}
unsigned f = L'\N{GREEK CAPITAL LETTER DELTA}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned f = L'\N{GREEK CAPITAL LETTER DELTA}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned g = u'\N{LOTUS}'; // expected-error {{character too large for enclosing character literal type}} \
// ext-warning {{extension}} cxx2b-warning {{C++2b}}
// ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned h = U'\N{LOTUS}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned i = u'\N{GREEK CAPITAL LETTER DELTA}'; // ext-warning {{extension}} cxx2b-warning {{C++2b}}
unsigned h = U'\N{LOTUS}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
unsigned i = u'\N{GREEK CAPITAL LETTER DELTA}'; // ext-warning {{extension}} cxx23-warning {{C++23}}
char j = '\NN'; // expected-error {{expected '{' after '\N' escape sequence}} expected-warning {{multi-character character constant}}
unsigned k = u'\N{LOTUS'; // expected-error {{incomplete universal character name}}
@ -115,11 +115,11 @@ void separators(void) {
// expected-warning@-2 3{{expression result unused}}
}
#if L'\N{GREEK CAPITAL LETTER GAMMA}' != L'Γ' // ext-warning {{extension}} cxx2b-warning {{C++2b}}
#if L'\N{GREEK CAPITAL LETTER GAMMA}' != L'Γ' // ext-warning {{extension}} cxx23-warning {{C++23}}
#error "oh no!"
#endif
#ifdef TRIGRAPHS
static_assert('\N??<DOLLAR SIGN??>' == '$'); // expected-warning 2{{trigraph converted}} \
// ext-warning {{extension}} cxx2b-warning {{C++2b}}
// ext-warning {{extension}} cxx23-warning {{C++23}}
#endif

View File

@ -3,7 +3,7 @@
// RUN: %clang_cc1 -std=c++14 -fcxx-exceptions -fsized-deallocation -verify %s
// RUN: %clang_cc1 -std=c++17 -fcxx-exceptions -fsized-deallocation -verify %s
// RUN: %clang_cc1 -std=c++20 -fcxx-exceptions -fsized-deallocation -verify %s
// RUN: %clang_cc1 -std=c++2b -fcxx-exceptions -fsized-deallocation -verify %s
// RUN: %clang_cc1 -std=c++23 -fcxx-exceptions -fsized-deallocation -verify %s
//
// RUN: %clang_cc1 -std=c++17 -fcxx-exceptions -fsized-deallocation -frelaxed-template-template-args -DRELAXED_TEMPLATE_TEMPLATE_ARGS=1 -verify %s
// RUN: %clang_cc1 -std=c++17 -fcxx-exceptions -fsized-deallocation -DCONCEPTS_TS=1 -verify %s
@ -28,7 +28,7 @@
#define check(macro, cxx98, cxx11, cxx14, cxx17, cxx20, cxx23) (cxx23 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx23)
#endif
// --- C++2b features ---
// --- C++23 features ---
#if check(implicit_move, 0, 0, 0, 0, 0, 202011)
#error "wrong value for __cpp_implicit_move"

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify %s
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s
#if 1z != 1
#error "z suffix must be recognized by preprocessor"

View File

@ -1,6 +1,6 @@
// REQUIRES: asserts
// RUN: %clang_cc1 -std=c++2b -x c++-header -emit-pch -fmodule-format=obj -I %S/Inputs \
// RUN: %clang_cc1 -std=c++23 -x c++-header -emit-pch -fmodule-format=obj -I %S/Inputs \
// RUN: -o %t.pch %S/Inputs/gmodules-deduction-guide.h \
// RUN: -mllvm -debug-only=pchcontainer &>%t-pch.ll
// RUN: cat %t-pch.ll | FileCheck %s

View File

@ -2,8 +2,8 @@
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++2b %t/A.cppm -emit-module-interface -o %t/A.pcm
// RUN: %clang_cc1 -std=c++2b %t/Use.cpp -fprebuilt-module-path=%t -fsyntax-only -verify
// RUN: %clang_cc1 -std=c++23 %t/A.cppm -emit-module-interface -o %t/A.pcm
// RUN: %clang_cc1 -std=c++23 %t/Use.cpp -fprebuilt-module-path=%t -fsyntax-only -verify
//--- A.cppm
module;

View File

@ -6,7 +6,7 @@
// RUN: %clang_cc1 -verify=expected,ge50,lt51 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,ge50,ge51 -fopenmp-simd -fopenmp-version=51 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,ge50,ge51,cxx2b -fopenmp -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++2b %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,ge50,ge51,cxx23 -fopenmp -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++23 %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@ -228,7 +228,7 @@ struct bar {
#if defined(__cplusplus) && __cplusplus >= 202101L
namespace cxx2b {
namespace cxx23 {
struct S {
int operator[](auto...);
@ -240,22 +240,22 @@ void f() {
#pragma omp target update to(test[1])
#pragma omp target update to(test[1, 2]) // cxx2b-error {{type 'int[10]' does not provide a subscript operator}} \
// cxx2b-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test[1, 2]) // cxx23-error {{type 'int[10]' does not provide a subscript operator}} \
// cxx23-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test [1:1:1])
#pragma omp target update to(test [1, 2:1:1]) // cxx2b-error {{expected ']'}} // expected-note {{'['}} \
// cxx2b-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test [1, 2:1:1]) // cxx23-error {{expected ']'}} // expected-note {{'['}} \
// cxx23-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test [1, 2:]) // cxx2b-error {{expected ']'}} // expected-note {{'['}} \
// cxx2b-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test [1, 2:]) // cxx23-error {{expected ']'}} // expected-note {{'['}} \
// cxx23-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test[1, 2 ::]) // cxx2b-error {{expected ']'}} // expected-note {{'['}} \
// cxx2b-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test[1, 2 ::]) // cxx23-error {{expected ']'}} // expected-note {{'['}} \
// cxx23-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test[]) // cxx2b-error {{type 'int[10]' does not provide a subscript operator}} \
// cxx2b-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(test[]) // cxx23-error {{type 'int[10]' does not provide a subscript operator}} \
// cxx23-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
S s;
(void)s[0];
(void)s[];

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
// RUN: %clang_cc1 -std=c++2b -x c++ %s -verify
// RUN: %clang_cc1 -std=c++20 -x c++ %s -verify
// RUN: %clang_cc1 -std=c++23 -x c++ %s -verify
// Test parsing of the optional requires-clause in a template-declaration.
@ -166,5 +166,5 @@ auto lambda3 = []<auto> requires(sizeof(char) == 1){};
auto lambda4 = [] requires(sizeof(char) == 1){}; // expected-error {{expected body of lambda expression}}
#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

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++11 -Wno-c99-designator %s
// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++2a -Wno-c99-designator %s
// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++2b -Wno-c99-designator %s
// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++20 -Wno-c99-designator %s
// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++23 -Wno-c99-designator %s
enum E { e };
@ -31,8 +31,8 @@ class C {
[] -> int { return 0; };
[] mutable -> int { return 0; };
#if __cplusplus <= 202002L
// expected-warning@-3 {{lambda without a parameter clause is a C++2b extension}}
// expected-warning@-3 {{is a C++2b extension}}
// expected-warning@-3 {{lambda without a parameter clause is a C++23 extension}}
// expected-warning@-3 {{is a C++23 extension}}
#endif
[](int) -> {}; // PR13652 expected-error {{expected a type}}
return 1;
@ -108,7 +108,7 @@ class C {
void attributes() {
[] __attribute__((noreturn)){};
#if __cplusplus <= 202002L
// expected-warning@-2 {{is a C++2b extension}}
// expected-warning@-2 {{is a C++23 extension}}
#endif
[]() [[]]
mutable {}; // expected-error {{expected body of lambda expression}}
@ -128,17 +128,17 @@ class C {
// rather than the type.
[][[]](){};
#if __cplusplus <= 202002L
// expected-warning@-2 {{an attribute specifier sequence in this position is a C++2b extension}}
// expected-warning@-2 {{an attribute specifier sequence in this position is a C++23 extension}}
#endif
#if __cplusplus > 201703L
[]<typename>[[]](){};
#if __cplusplus <= 202002L
// expected-warning@-2 {{an attribute specifier sequence in this position is a C++2b extension}}
// expected-warning@-2 {{an attribute specifier sequence in this position is a C++23 extension}}
#endif
#endif
[][[]]{};
#if __cplusplus <= 202002L
// expected-warning@-2 {{an attribute specifier sequence in this position is a C++2b extension}}
// expected-warning@-2 {{an attribute specifier sequence in this position is a C++23 extension}}
#endif
}
@ -146,8 +146,8 @@ class C {
[] mutable {};
[] noexcept {};
#if __cplusplus <= 202002L
// expected-warning@-3 {{is a C++2b extension}}
// expected-warning@-3 {{is a C++2b extension}}
// expected-warning@-3 {{is a C++23 extension}}
// expected-warning@-3 {{is a C++23 extension}}
#endif
}
};

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b %s -verify
// RUN: %clang_cc1 -std=c++23 %s -verify
// RUN: %clang_cc1 -std=c++20 %s -verify
// RUN: %clang_cc1 -std=c++17 %s -verify
// RUN: %clang_cc1 -std=c++14 %s -verify
@ -9,7 +9,7 @@ auto XL0 = [] constexpr { return true; };
// expected-warning@-2 {{is a C++17 extension}}
#endif
#if __cplusplus <= 202002L
// expected-warning@-5 {{lambda without a parameter clause is a C++2b extension}}
// expected-warning@-5 {{lambda without a parameter clause is a C++23 extension}}
#endif
auto XL1 = []() mutable //
mutable // expected-error{{cannot appear multiple times}}

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++2b %s -verify
// RUN: %clang_cc1 -std=c++2a %s -verify
// RUN: %clang_cc1 -std=c++23 %s -verify
// RUN: %clang_cc1 -std=c++20 %s -verify
auto L0 = []<> { }; //expected-error {{cannot be empty}}
@ -14,14 +14,14 @@ auto L6 = []<auto>{};
auto L7 = []<auto>() noexcept {};
auto L8 = []<auto> noexcept {};
#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
auto L9 = []<auto> requires true {};
auto L10 = []<auto> requires true(){};
auto L11 = []<auto> requires true() noexcept {};
auto L12 = []<auto> requires true noexcept {};
#if __cplusplus <= 202002L
// expected-warning@-2 {{is a C++2b extension}}
// expected-warning@-2 {{is a C++23 extension}}
#endif
auto L13 = []<auto>() noexcept requires true {};
auto L14 = []<auto> requires true() noexcept requires true {};
@ -29,6 +29,6 @@ auto L14 = []<auto> requires true() noexcept requires true {};
auto XL0 = []<auto> noexcept requires true {}; // expected-error {{expected body of lambda expression}}
auto XL1 = []<auto> requires true noexcept requires true {}; // expected-error {{expected body}}
#if __cplusplus <= 202002L
// expected-warning@-3 {{is a C++2b extension}}
// expected-warning@-3 {{is a C++2b extension}}
// expected-warning@-3 {{is a C++23 extension}}
// expected-warning@-3 {{is a C++23 extension}}
#endif

View File

@ -1,14 +1,14 @@
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx2b -std=c++2b -Wpre-c++2b-compat %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx23 -std=c++23 -Wpre-c++23-compat %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx20 -std=c++20 %s
void looks_like_decltype_auto() {
decltype(auto(42)) b = 42; // cxx20-error {{'auto' not allowed here}} \
cxx2b-warning {{'auto' as a functional-style cast is incompatible with C++ standards before C++2b}}
cxx23-warning {{'auto' as a functional-style cast is incompatible with C++ standards before C++23}}
decltype(long *) a = 42; // expected-error {{expected '(' for function-style cast or type construction}} \
expected-error {{expected expression}}
decltype(auto *) a = 42; // expected-error {{expected '(' for function-style cast or type construction}} \
expected-error {{expected expression}}
decltype(auto()) c = 42; // cxx2b-error {{initializer for functional-style cast to 'auto' is empty}} \
decltype(auto()) c = 42; // cxx23-error {{initializer for functional-style cast to 'auto' is empty}} \
cxx20-error {{'auto' not allowed here}}
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify=expected -std=c++2b -Wall %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected -std=c++23 -Wall %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,expected-cxx20 -std=c++20 -Wall %s
namespace ns {
@ -7,13 +7,13 @@ namespace ns {
}
void f() {
for (using foo = int;true;); //expected-cxx20-warning {{alias declaration in this context is a C++2b extension}}
for (using foo = int;true;); //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
switch(using foo = int; 0) { //expected-cxx20-warning {{alias declaration in this context is a C++2b extension}}
switch(using foo = int; 0) { //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
case 0: break;
}
if(using foo = int; false) {} //expected-cxx20-warning {{alias declaration in this context is a C++2b extension}}
if(using foo = int; false) {} //expected-cxx20-warning {{alias declaration in this context is a C++23 extension}}
if (using enum ns::e; false){} // expected-error {{expected '='}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx2b -std=c++2b -Wpre-c++2b-compat %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx23 -std=c++23 -Wpre-c++23-compat %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx20 -std=c++20 %s
void test_label_in_func() {
@ -7,8 +7,8 @@ label1:
label2:
x = 1;
label3: label4: label5:
} // cxx20-warning {{label at end of compound statement is a C++2b extension}} \
cxx2b-warning {{label at end of compound statement is incompatible with C++ standards before C++2b}}
} // cxx20-warning {{label at end of compound statement is a C++23 extension}} \
cxx23-warning {{label at end of compound statement is incompatible with C++ standards before C++23}}
int test_label_in_switch(int v) {
switch (v) {
@ -17,15 +17,15 @@ int test_label_in_switch(int v) {
case 2:
return 2;
case 3: case 4: case 5:
} // cxx20-warning {{label at end of compound statement is a C++2b extension}} \
cxx2b-warning {{label at end of compound statement is incompatible with C++ standards before C++2b}}
} // cxx20-warning {{label at end of compound statement is a C++23 extension}} \
cxx23-warning {{label at end of compound statement is incompatible with C++ standards before C++23}}
switch (v) {
case 6:
return 6;
default:
} // cxx20-warning {{label at end of compound statement is a C++2b extension}} \
cxx2b-warning {{label at end of compound statement is incompatible with C++ standards before C++2b}}
} // cxx20-warning {{label at end of compound statement is a C++23 extension}} \
cxx23-warning {{label at end of compound statement is incompatible with C++ standards before C++23}}
return 0;
}

View File

@ -1,16 +1,16 @@
// RUN: %clang_cc1 -std=c++20 %s -verify=cxx20
// RUN: %clang_cc1 -std=c++2b %s -verify=cxx2b
// RUN: %clang_cc1 -std=c++2b -Wpre-c++2b-compat %s -verify=precxx2b
// RUN: %clang_cc1 -std=c++2b -pedantic %s -verify=cxx2b
// RUN: %clang_cc1 -std=c++23 %s -verify=cxx23
// RUN: %clang_cc1 -std=c++23 -Wpre-c++23-compat %s -verify=precxx23
// RUN: %clang_cc1 -std=c++23 -pedantic %s -verify=cxx23
//cxx2b-no-diagnostics
//cxx23-no-diagnostics
auto L1 = [] constexpr {};
// cxx20-warning@-1 {{lambda without a parameter clause is a C++2b extension}}
// cxx20-warning@-1 {{lambda without a parameter clause is a C++23 extension}}
auto L2 = []() static {};
// cxx20-warning@-1 {{static lambdas are a C++2b extension}}
// precxx2b-warning@-2 {{static lambdas are incompatible with C++ standards before C++2b}}
// cxx20-warning@-1 {{static lambdas are a C++23 extension}}
// precxx23-warning@-2 {{static lambdas are incompatible with C++ standards before C++23}}
auto L3 = [] static {};
// cxx20-warning@-1 {{lambda without a parameter clause is a C++2b extension}}
// cxx20-warning@-2 {{static lambdas are a C++2b extension}}
// precxx2b-warning@-3 {{static lambdas are incompatible with C++ standards before C++2b}}
// cxx20-warning@-1 {{lambda without a parameter clause is a C++23 extension}}
// cxx20-warning@-2 {{static lambdas are a C++23 extension}}
// precxx23-warning@-3 {{static lambdas are incompatible with C++ standards before C++23}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++2b %s -verify
// RUN: %clang_cc1 -std=c++23 %s -verify
auto LL0 = [] {};
auto LL1 = []() {};

View File

@ -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}}
@ -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}}
}

View File

@ -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() {
@ -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) {
@ -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 {

View File

@ -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;
@ -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
@ -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
@ -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
@ -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
@ -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}}

View File

@ -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
@ -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

View File

@ -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 '('}}

Some files were not shown because too many files have changed in this diff Show More