microsoft / microsoft/vscode-cpptools
VSCode reports 'converstion from "x" to "y" is invalid in constant-expression evalution', yet code builds fine
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
Type: LanguageService
Describe the bug
- OS and Version: Windows 10 build 17686
- VS Code Version: 1.23.1
- C/C++ Extension Version: 0.17.4
- Other extensions you installed (and if the issue persists after disabling them): I have others extensions installed, but after disabling all of them except my theme (Railgun) and this addon, it still persists.
- Description: VSCode reports an error for code that builds correctly.
To Reproduce
Steps to reproduce the behavior: (The default C++ properties were used)
- Clone the following gist: https://gist.github.com/sylveon/b63621297d566d06ab38bd5586eca0ed
- Open it in vscode
- Open main.cpp
- See red squiggles on CalculateHueGradient() call
- When hovering, you can read
expression must have a constant value -- conversion from "float" to "unsigned short" is invalid in constant-expression evaluation
Expected behavior
No error, like msvc and clang do while building the snippet:
C:\Users\Charles\Git\TranslucentTB>cl test.cpp /EHsc
Microsoft (R) C/C++ Optimizing Compiler Version 19.14.26430 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 14.14.26430.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
C:\Users\Charles\Git\TranslucentTB>clang-cl --version
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
C:\Users\Charles\Git\TranslucentTB>clang-cl /EHsc test.cpp
(no output, meaning a successful compilation)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Bericht, indem du das verlinkte gist in VS Code öffnest und die roten Wellenlinien beim Aufruf von CalculateHueGradient() in main.cpp untersuchst. Vergleiche die Diagnose des Sprachdienstes mit den im Issue gezeigten erfolgreichen MSVC- und clang-cl-Builds; als erledigt gilt, dass die gültige Konvertierung keinen Fehler mehr erzeugt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, vscode
- Bereich
- compilers, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100