diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -451,9 +451,8 @@ Builder.defineMacro("__STDC_VERSION__", "199409L"); } else { // -- __cplusplus - // FIXME: Use correct value for C++23. - if (LangOpts.CPlusPlus2b) - Builder.defineMacro("__cplusplus", "202101L"); + if (LangOpts.CPlusPlus23) + Builder.defineMacro("__cplusplus", "202302L"); // [C++20] The integer literal 202002L. else if (LangOpts.CPlusPlus20) Builder.defineMacro("__cplusplus", "202002L"); diff --git a/clang/test/OpenMP/target_update_messages.cpp b/clang/test/OpenMP/target_update_messages.cpp --- a/clang/test/OpenMP/target_update_messages.cpp +++ b/clang/test/OpenMP/target_update_messages.cpp @@ -226,7 +226,7 @@ } }; -#if defined(__cplusplus) && __cplusplus >= 202101L +#if defined(__cplusplus) && __cplusplus >= 202302L namespace cxx2b { diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -15,7 +15,7 @@ // CXX2B:#define __GXX_EXPERIMENTAL_CXX0X__ 1 // CXX2B:#define __GXX_RTTI 1 // CXX2B:#define __GXX_WEAK__ 1 -// CXX2B:#define __cplusplus 202101L +// CXX2B:#define __cplusplus 202302L // CXX2B:#define __private_extern__ extern // // RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=c++20 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix CXX2A %s @@ -137,7 +137,7 @@ // // GXX2B:#define __GNUG__ 4 // GXX2B:#define __GXX_WEAK__ 1 -// GXX2B:#define __cplusplus 202101L +// GXX2B:#define __cplusplus 202302L // GXX2B:#define __private_extern__ extern // // RUN: %clang_cc1 -x c++ -fgnuc-version=4.2.1 -std=gnu++20 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GXX2A %s