vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

IntelliSense not handling constexpr float types properly (starting from extension 1.17.2)

Open rsarrazin2 opened this issue 2 years ago • 4 comments
trafficstars

Environment

  • OS and Version: Ubuntu 20.04 @ WSL2
  • VS Code Version: 1.81.1
  • C/C++ Extension Version: >= 1.17.2
  • If using SSH remote, specify OS of remote machine: WSL2 @ Windows 11

Bug Summary and Steps to Reproduce

Bug Summary: IntelliSense reports errors (at least on constexpr literals) that the compiler doesn't.

Steps to reproduce:

  1. Clone the minimum viable example.
  2. Build it using the CMake extension (works probably as well when manually running CMake).
  3. Open example.cpp.
  4. If not happened automatically, run the "C/C++: Run Code Analysis on Active File" command.
  5. You'll see the 4 IntelliSense errors that aren't reported by the compiler:

image

Expected behavior:

  • No Intellisense errors shall be displayed.

Notes:

  • Interestingly the errors affect both float and double literals, and the 0 literal doesn't show the error.
  • Reverting to any version < 1.17.2 (e.g. 1.16.3) solves the problem.
  • Issue opened upon suggestion by @Colengms in #11351, in this comment.

Configuration and Logs

* No `c_cpp_properties.json` used
* No `C/C++: Log Diagnostics` command found
* Output from debug info with Debug log level: see file pasted in "Additional context"

Other Extensions

No response

Additional context

debug_output.log

rsarrazin2 avatar Aug 30 '23 08:08 rsarrazin2

Note: This was moved from https://github.com/microsoft/vscode-cpptools/issues/11351#issuecomment-1697499243 , and the internal bug number is 1839628 (EDG).

Colengms avatar Aug 30 '23 20:08 Colengms

Note that v1.18.5 still presents the issue.

rsarrazin2 avatar Jan 16 '24 17:01 rsarrazin2

This issue is about to celebrate its first birthday but is unfortunately still present in v1.21.6. Kindly requesting to reconsider for prioritization.

rsarrazin2 avatar Aug 13 '24 09:08 rsarrazin2

@rsarrazin2 I've pinged the team.

sean-mcmanus avatar Aug 13 '24 11:08 sean-mcmanus

The issue is still present in current release 1.22.11 and pre-release 1.23.2. I kindly remind that it used to work with revisions < 1.17.2 so that it should be possible to find the cause of the regression. Thank you.

rsarrazin2 avatar Dec 18 '24 10:12 rsarrazin2

Still present in 1.23.6. Searching issues for "expression must have a constant value" yields several hits (e.g. #12810, #12983) so it seems to be a real issue.

rsarrazin2 avatar Mar 24 '25 09:03 rsarrazin2