microsoft / microsoft/vscode-cpptools

Unwanted error message appears: Chained designators are not permitted for a class type with a nontrivial destructor

Aperta
#11,494 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Language Service Visual Studio
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre la diagnostica in VS Code C/C++ IntelliSense 1.17.5 usando l’esempio C++20 fornito, il percorso del compilatore clang e la configurazione macOS. Tracciare la gestione del chained designator da parte di IntelliSense quando Foo contiene std::string, quindi verificare che l’esempio valido non segnali più l’errore 3480, mentre i chained designators non validi continuino a essere diagnosticati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, vscode
Ambito
compilers, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.