From a1b893afc5c58fee6df5fb895cd489ec83e6facf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 14 May 2024 09:48:54 +0200 Subject: Map latest/experimental cxx.std values to C++26 from GCC 14 and Clang 18 --- libbuild2/cxx/init.cxx | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'libbuild2/cxx') diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx index 2d897ca..3185eaa 100644 --- a/libbuild2/cxx/init.cxx +++ b/libbuild2/cxx/init.cxx @@ -335,7 +335,12 @@ namespace build2 { case compiler_type::gcc: { - if (mj >= 11) + if (mj >= 14) + { + o = "-std=c++26"; + cplusplus = 202400; + } + else if (mj >= 11) { o = "-std=c++23"; cplusplus = 202302; @@ -367,25 +372,29 @@ namespace build2 } case compiler_type::clang: { - // Clang 10.0.0 targeting MSVC 16.4 and 16.5 (preview) in the - // c++2a mode uncovers some Concepts-related bugs in MSVC STL - // (LLVM bug #44956). So in this case we map `latest` to - // c++17. - // - // While reportedly this has been fixed in the later versions - // of MSVC, instead of somehow passing the version of MSVC - // Clang is targeting, we will just assume that Clang 11 - // and later are used with a sufficiently new version of - // MSVC. - // - - if (mj >= 13) + if (mj >= 18) + { + o = "-std=c++26"; + cplusplus = 202400; + } + else if (mj >= 13) { o = "-std=c++2b"; cplusplus = 202302; } else if (mj == 10 && latest && tt.system == "win32-msvc") { + // Clang 10.0.0 targeting MSVC 16.4 and 16.5 (preview) in + // the c++2a mode uncovers some Concepts-related bugs in + // MSVC STL (LLVM bug #44956). So in this case we map + // `latest` to c++17. + // + // While reportedly this has been fixed in the later + // versions of MSVC, instead of somehow passing the version + // of MSVC Clang is targeting, we will just assume that + // Clang 11 and later are used with a sufficiently new + // version of MSVC. + // o = "-std=c++17"; cplusplus = 201703; } @@ -446,7 +455,7 @@ namespace build2 // 26 to 2c for compatibility with older versions of the // compilers. // - // @@ TMP: update C++26 __cplusplus value once known. + // @@ TMP: update C++26 __cplusplus value once known (and above). // o = "-std="; -- cgit v1.1