Is there a workaround for java.lang.IllegalArgumentException: /std:c++23preview is not supported

I am using sonar-scanner-6.1.0.4477-windows-x64 for my open source project.
I just upgraded my MSVC C++ compiler settings to C++23, by defining
<LanguageStandard>stdcpp23</LanguageStandard>

which is a new with Visual Studio 2022 version 17.13. At the moment this will pass /std:c++23preview on the cmd-line to cl.exe. This causes however a problem for sonarscanner:

The SonarScanner failed in the CI pipeline with:
15:57:42.355 ERROR Error during SonarScanner Engine execution
java.lang.IllegalArgumentException: /std:c++23preview is not supported.
	at com.sonar.cpp.analyzer.MsvcDriver$MSVCVersion.cplusplusValue(MsvcDriver.java:903)
	at com.sonar.cpp.analyzer.MsvcDriver.prepareActionCpp(MsvcDriver.java:717)
	at com.sonar.cpp.analyzer.MsvcDriver.onCapture(MsvcDriver.java:229)
	at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:47)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$8(CFamilySensor.java:600)
	at com.sonar.cpp.plugin.BuildWrapperJsonReader.readCaptures(BuildWrapperJsonReader.java:114)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:598)
	at com.sonar.cpp.plugin.CFamilySensor.processConfigurationReader(CFamilySensor.java:508)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$3(CFamilySensor.java:248)
	at java.base/java.lang.Iterable.forEach(Unknown Source)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:248)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:192)

Is there a workaround for this problem?

Hey there!

What version of SonarQube are you using? You can typically find this information in the footer of your instance.

Hi Colin,
The problem is in my CI github action:

16:47:45.222 INFO Scanner configuration file: D:\a\netpbm-wic-codec\netpbm-wic-codec\.sonar\sonar-scanner-6.1.0.4477-windows-x64\bin\..\conf\sonar-scanner.properties

[10](https://github.com/team-charls/netpbm-wic-codec/actions/runs/13606819320/job/38039261304#step:7:11)16:47:45.222 INFO Project root configuration file: D:\a\netpbm-wic-codec\netpbm-wic-codec\sonar-project.properties

[11](https://github.com/team-charls/netpbm-wic-codec/actions/runs/13606819320/job/38039261304#step:7:12)16:47:45.237 INFO SonarScanner CLI 6.1.0.4477

[12](https://github.com/team-charls/netpbm-wic-codec/actions/runs/13606819320/job/38039261304#step:7:13)16:47:45.237 INFO Java 17.0.11 Eclipse Adoptium (64-bit)

[13](https://github.com/team-charls/netpbm-wic-codec/actions/runs/13606819320/job/38039261304#step:7:14)16:47:45.237 INFO Windows Server 2022 10.0 amd64