microsoft / microsoft/vscode-cpptools
IntelliSense reports error when template default argument is decltype(lambda) (C++20)
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Type: LanguageService
IntelliSense reports error with this example:
template <class U = decltype([]() {})>
void foo() {}
int main() {
foo(); // <-- error here: no instance of function template "foo" matches the argument list
}
While this code perfectly compiles with GCC and C++20: https://godbolt.org/z/b5a7hj
It won't compile with C++17 tho, so I believe the problem lies in C++20 compatibility.
Describe the bug
- OS and Version: Windows 10 2004, on WSL2 Ubuntu 20.04
- VS Code Version: 1.52.1
- C/C++ Extension Version: v1.2.0-insiders2
- Other extensions you installed (and if the issue persists after disabling them): issue persists without any other extension
- Does this issue involve using SSH remote to run the extension on a remote machine?: WSL2
- A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc). Reproduceable with single file
Steps to reproduce
The code above with configuration:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "c++20", // gnu++20 results in same issue
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
Expected behavior
For IntelliSense to not report false error when using C++20.
Logs
-------- Diagnostics - 1/21/2021, 1:56:40 PM
Version: 1.2.0-insiders2
Current Configuration:
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [],
"intelliSenseModeIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"compilerPathIsExplicit": true,
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
Translation Unit Mappings:
[ /home/oliver/pro/lulu/poc/poc.cpp ]:
/home/oliver/pro/lulu/poc/poc.cpp
Translation Unit Configurations:
[ /home/oliver/pro/lulu/poc/poc.cpp ]:
Process ID: 15806
Memory Usage: 16 MB
Compiler Path: /usr/bin/gcc
Includes:
/usr/include/c++/10
/usr/include/x86_64-linux-gnu/c++/10
/usr/include/c++/10/backward
/usr/lib/gcc/x86_64-linux-gnu/10/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
Standard Version: c++20
IntelliSense Mode: linux-gcc-x64
Other Flags:
--g++
--gnu_version=100200
Total Memory Usage: 16 MB
------- Workspace parsing diagnostics -------
Number of folders and files enumerated: 3585
Number of files discovered (not excluded): 3424
Screenshots

Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Iniziate con l’esempio C++20 in un singolo file e con la configurazione c_cpp_properties.json mostrata nell’issue, quindi riproducete la diagnosi errata di IntelliSense confrontando il risultato di GCC. Il lavoro è concluso quando IntelliSense accetta il template con un argomento predefinito di decltype(lambda) senza l’errore di function-template segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100