microsoft / microsoft/vscode-cpptools
Unwanted error message appears: Chained designators are not permitted for a class type with a nontrivial destructor
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and Version: 13.6
- VS Code Version: 1.82.2
- C/C++ Extension Version: 1.17.5
Bug Summary and Steps to Reproduce
Bug Summary:
I have the following code that compiles without a problem with clang 15.0.0
struct Bar {
float right, left, top, bottom;
};
struct Foo {
std::string background;
Bar padding;
};
Foo foo = {
.padding.left = 3.f,
};
But on the line where I have .padding.left = 3.f, I get the following error in vscode only
[{
"resource": "/Users/miguel/prototype/src/main.cpp",
"owner": "C/C++: IntelliSense",
"code": "3480",
"severity": 8,
"message": "chained designators are not permitted for a class type with a nontrivial destructor",
"source": "C/C++",
"startLineNumber": 28,
"startColumn": 13,
"endLineNumber": 28,
"endColumn": 13
}]
Another odd thing is that if I remove the std::string background; then the error disappears
Steps to reproduce:
Copy the code above and vscode should complain
Expected behavior:
I don't get an error because the code works and compiles fine
Configuration and Logs
-------- Diagnostics - 03/10/2023, 12:19:57
Version: 1.17.5
Current Configuration:
{
"name": "Mac",
"includePath": [
"/Users/miguel/prototype/lib/macos/include",
"/Users/miguel/prototype/include",
"/Users/miguel/prototype"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"intelliSenseMode": "macos-clang-arm64",
"compilerPathInCppPropertiesJson": "/usr/bin/clang",
"forcedInclude": [
"/Users/miguel/prototype/src/pch.hpp"
],
"cppStandard": "c++20",
"intelliSenseModeIsExplicit": false,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": true,
"mergeConfigurations": false,
"compilerPathIsExplicit": false,
"browse": {
"path": [
"/Users/miguel/prototype/lib/macos/include",
"/Users/miguel/prototype/include",
"/Users/miguel/prototype",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
cpptools version (native): 1.17.5.0
Translation Unit Mappings:
[ /Users/miguel/prototype/src/main.cpp ]:
/Users/miguel/prototype/src/main.cpp
Translation Unit Configurations:
[ /Users/miguel/prototype/src/main.cpp ]:
Process ID: 42943
Memory Usage: 458 MB
Compiler Path: /usr/bin/clang
Includes:
/Users/miguel/prototype/lib/macos/include
/Users/miguel/prototype/include
/Users/miguel/prototype
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
Frameworks:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
Forced Includes:
/Users/miguel/prototype/src/pch.hpp
Standard Version: c++20
IntelliSense Mode: macos-clang-arm64
Other Flags:
--clang
--clang_version=160000
Total Memory Usage: 458 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 10273
Other Extensions
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the diagnostic in VS Code C/C++ IntelliSense 1.17.5 using the supplied C++20 example, clang compiler path, and macOS configuration. Trace the IntelliSense handling of the chained designator when Foo contains std::string, then verify that the valid example no longer reports error 3480 while invalid chained designators remain diagnosed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100