microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.5k stars 1.55k forks source link

C23 auto type inference support #11269

Open ArmoredPony opened 1 year ago

ArmoredPony commented 1 year ago

C standard is set to c23 in extension settings.

In C23 standard the auto keyword allows type inference doing pretty much the same job as __auto_type GNU extension. The latter is supported by your extension and if I hover my mouse over declared variable I see that the type is infered correctly. image

But if I change __auto_type to auto an error is yield: image This code compiles and works correctly with -std=c2x flag.

Since __auto_type is already supported, can auto behave the same way if C standard parameter is set to c23?

sean-mcmanus commented 1 year ago

This is not implemented by our IntelliSense parser yet -- the only compiler that currently implements this is gcc 13.

See https://en.cppreference.com/w/c/23 for details and updates.