Vscode-cpptools: C++17 template argument deduction and structured binding type deduction

Created on 8 Jun 2018  路  3Comments  路  Source: microsoft/vscode-cpptools

Type: LanguageService

I encountered two intellisense issues that seem to be in conflict with the C++17 standards:

The first one is that the C++ extension considers class template argument deduction an error (http://en.cppreference.com/w/cpp/language/class_template_argument_deduction) with red squiggles. Below is the screenshot:
template argument
This code compiles in major compilers with c++17 standards. I'm pretty sure I have the c++17 standard on for intellisense, as it is on by default in the cpp properties file, and structured bindings work.

The second issue is the type deduction in the auto [..., ...] structured bindings. Below is the screenshot:
structured binding
Variable a here should be of type int instead of int&. I checked with gcc and clang by tricking them to print out the type through template compiler errors.

  • OS and Version: Manjaro Linux
  • VS Code Version: 1.24.0
  • C/C++ Extension Version: 0.17.4
Language Service bug fixed (release pending) parser

Most helpful comment

Thanks for reporting this. I'm able to repro the problems.

All 3 comments

Thanks for reporting this. I'm able to repro the problems.

The bogus error will be fixed in our pending 0.17.7-Insiders update, but the "int &" bug still repros (even with VS 2017), so I created a new bug for that: https://github.com/Microsoft/vscode-cpptools/issues/2256 .

Was this page helpful?
0 / 5 - 0 ratings