Open
Description
Environment
- OS and Version: Ubuntu 22.04.2 LTS
- VS Code Version: 1.79.2
- C/C++ Extension Version: v1.16.1
- If using SSH remote, specify OS of remote machine: none
- g++ version
Bug Summary and Steps to Reproduce
Bug Summary:
Intellisense treats std::vector variable "vec2" as a function declaration.
The code can be successfully compiled and run.
Steps to reproduce:
#include <iostream>
#include <vector>
const int width = 5;
const int height = 5;
std::vector<float> vec1(width); // no problem
std::vector<float> vec2(width * height); // Function definition for 'vec2' not found.
int main()
{
for (auto i : vec1)
std::cout << i << " ";
std::cout << std::endl;
for (auto i : vec2)
std::cout << i << " ";
std::cout << std::endl;
return 0;
}
Expected behavior:
vec2 is a variable of type std::vector, the length is width * height
Configuration and Logs
c_cpp_properties.json:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
OUTPUT:
loggingLevel: Debug
loggingLevel has changed to: Debug
LSP: cpptools/textEditorSelectionChange
LSP: cpptools/activeDocumentChange: file:///home/feng/Code/test/test.cpp
LSP: cpptools/getCodeActions: file:///home/feng/Code/test/test.cpp (id: 37)
LSP: cpptools/textEditorSelectionChange
LSP: textDocument/documentHighlight: file:///home/feng/Code/test/test.cpp (id: 38)
LSP: cpptools/getFoldingRanges: file:///home/feng/Code/test/test.cpp (id: 39)
LSP: cpptools/getCodeActions: file:///home/feng/Code/test/test.cpp (id: 40)
LSP: cpptools/textEditorSelectionChange
LSP: cpptools/activeDocumentChange: file:///home/feng/Code/test/test.cpp
LSP: cpptools/getCodeActions: file:///home/feng/Code/test/test.cpp (id: 41)
LSP: cpptools/textEditorSelectionChange
LSP: textDocument/documentHighlight: file:///home/feng/Code/test/test.cpp (id: 42)
LSP: cpptools/getFoldingRanges: file:///home/feng/Code/test/test.cpp (id: 43)
LSP: cpptools/getCodeActions: file:///home/feng/Code/test/test.cpp (id: 44)
LSP: cpptools/textEditorSelectionChange
LSP: cpptools/activeDocumentChange: file:///home/feng/Code/test/test.cpp
Other Extensions
No response
Additional context
Metadata
Metadata
Assignees
Type
Projects
Status
No status