@@ -998,7 +998,7 @@ export async function parseCustomConfigProvider(cancel: vscode.CancellationToken
998998 // If the command is compiling the same extension or uses -TC/-TP, send all the source files in one batch.
999999 if ( language ) {
10001000 // More standard validation and defaults, in the context of the whole command.
1001- let standard : util . StandardVersion = parseStandard ( ext . extension . getCppToolsVersion ( ) , standardStr , language ) ;
1001+ let standard : util . StandardVersion | undefined = parseStandard ( ext . extension . getCppToolsVersion ( ) , standardStr , language ) ;
10021002
10031003 if ( ext . extension ) {
10041004 onFoundCustomConfigProviderItem ( { defines, includes, forcedIncludes, standard, intelliSenseMode, compilerFullPath, compilerArgs, files, windowsSDKVersion, currentPath, line } ) ;
@@ -1014,7 +1014,7 @@ export async function parseCustomConfigProvider(cancel: vscode.CancellationToken
10141014 }
10151015
10161016 // More standard validation and defaults, in the context of each source file.
1017- let standard : util . StandardVersion = parseStandard ( ext . extension . getCppToolsVersion ( ) , standardStr , language ) ;
1017+ let standard : util . StandardVersion | undefined = parseStandard ( ext . extension . getCppToolsVersion ( ) , standardStr , language ) ;
10181018
10191019 if ( ext . extension ) {
10201020 onFoundCustomConfigProviderItem ( { defines, includes, forcedIncludes, standard, intelliSenseMode, compilerFullPath, compilerArgs, files : [ file ] , windowsSDKVersion, currentPath, line } ) ;
@@ -1492,9 +1492,10 @@ function getTargetArchitecture(compilerArgs: string): util.TargetArchitecture {
14921492 return targetArch ;
14931493}
14941494
1495- function parseStandard ( cppVersion : cpp . Version | undefined , std : string | undefined , language : util . Language ) : util . StandardVersion {
1495+ export function parseStandard ( cppVersion : cpp . Version | undefined , std : string | undefined , language : util . Language ) : util . StandardVersion | undefined {
14961496 let canUseGnu : boolean = ( cppVersion !== undefined && cppVersion >= cpp . Version . v4 ) ;
1497- let standard : util . StandardVersion ;
1497+ let canUseCxx23 : boolean = ( cppVersion !== undefined && cppVersion >= cpp . Version . v6 ) ;
1498+ let standard : util . StandardVersion | undefined ;
14981499 if ( cppVersion && cppVersion >= cpp . Version . v5 && std === undefined ) {
14991500 // C/C++ standard is optional for CppTools v5+ and is determined by CppTools.
15001501 return undefined ;
@@ -1508,7 +1509,7 @@ function parseStandard(cppVersion: cpp.Version | undefined, std: string | undefi
15081509 return "c++17" ;
15091510 }
15101511 } else if ( language === "cpp" ) {
1511- standard = parseCppStandard ( std , canUseGnu ) ;
1512+ standard = parseCppStandard ( std , canUseGnu , canUseCxx23 ) ;
15121513 if ( ! standard ) {
15131514 logger . message ( `Unknown C++ standard control flag: ${ std } ` , "Normal" ) ;
15141515 }
@@ -1518,7 +1519,7 @@ function parseStandard(cppVersion: cpp.Version | undefined, std: string | undefi
15181519 logger . message ( `Unknown C standard control flag: ${ std } ` , "Normal" ) ;
15191520 }
15201521 } else if ( language === undefined ) {
1521- standard = parseCppStandard ( std , canUseGnu ) ;
1522+ standard = parseCppStandard ( std , canUseGnu , canUseCxx23 ) ;
15221523 if ( ! standard ) {
15231524 standard = parseCStandard ( std , canUseGnu ) ;
15241525 }
@@ -1532,9 +1533,15 @@ function parseStandard(cppVersion: cpp.Version | undefined, std: string | undefi
15321533 return standard ;
15331534}
15341535
1535- function parseCppStandard ( std : string , canUseGnu : boolean ) : util . StandardVersion {
1536+ function parseCppStandard ( std : string , canUseGnu : boolean , canUseCxx23 : boolean ) : util . StandardVersion | undefined {
15361537 const isGnu : boolean = canUseGnu && std . startsWith ( 'gnu' ) ;
1537- if ( std . endsWith ( '++2a' ) || std . endsWith ( '++20' ) || std . endsWith ( '++latest' ) ) {
1538+ if ( std . endsWith ( '++23' ) || std . endsWith ( '++2b' ) || std . endsWith ( '++latest' ) ) {
1539+ if ( canUseCxx23 ) {
1540+ return isGnu ? 'gnu++23' : 'c++23' ;
1541+ } else {
1542+ return isGnu ? 'gnu++20' : 'c++20' ;
1543+ }
1544+ } else if ( std . endsWith ( '++2a' ) || std . endsWith ( '++20' ) ) {
15381545 return isGnu ? 'gnu++20' : 'c++20' ;
15391546 } else if ( std . endsWith ( '++17' ) || std . endsWith ( '++1z' ) ) {
15401547 return isGnu ? 'gnu++17' : 'c++17' ;
@@ -1551,7 +1558,7 @@ function parseCppStandard(std: string, canUseGnu: boolean): util.StandardVersion
15511558 }
15521559 }
15531560
1554- function parseCStandard ( std : string , canUseGnu : boolean ) : util . StandardVersion {
1561+ function parseCStandard ( std : string , canUseGnu : boolean ) : util . StandardVersion | undefined {
15551562 // GNU options from: https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options
15561563 const isGnu : boolean = canUseGnu && std . startsWith ( 'gnu' ) ;
15571564 if ( / ( c | g n u ) ( 9 0 | 8 9 | i s o 9 8 9 9 : ( 1 9 9 0 | 1 9 9 4 0 9 ) ) / . test ( std ) ) {
0 commit comments