Skip to content

Commit da449d1

Browse files
authored
return proper __cplusplus value for C++23 / improved preliminary C23 support (#318)
1 parent 62a8c7b commit da449d1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

simplecpp.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3674,10 +3674,12 @@ std::string simplecpp::getCStdString(const std::string &std)
36743674
return "201112L";
36753675
if (std == "c17" || std == "c18" || std == "iso9899:2017" || std == "iso9899:2018" || std == "gnu17"|| std == "gnu18")
36763676
return "201710L";
3677-
if (std == "c2x" || std == "gnu2x") {
3677+
if (std == "c23" || std == "gnu23" || std == "c2x" || std == "gnu2x") {
36783678
// supported by GCC 9+ and Clang 9+
36793679
// Clang 9, 10, 11, 12, 13 return "201710L"
3680-
return "202000L";
3680+
// Clang 14, 15, 16, 17 return "202000L"
3681+
// Clang 9, 10, 11, 12, 13, 14, 15, 16, 17 do not support "c23" and "gnu23"
3682+
return "202311L";
36813683
}
36823684
return "";
36833685
}
@@ -3701,7 +3703,7 @@ std::string simplecpp::getCppStdString(const std::string &std)
37013703
// GCC 11, 12, 13 return "202100L"
37023704
// Clang 12, 13, 14, 15, 16 do not support "c++23" and "gnu++23" and return "202101L"
37033705
// Clang 17, 18 return "202302L"
3704-
return "202100L"; // TODO: update value?
3706+
return "202302L";
37053707
}
37063708
if (std == "c++26" || std == "c++2c" || std == "gnu++26" || std == "gnu++2c") {
37073709
// supported by Clang 17+

0 commit comments

Comments
 (0)