Skip to content

Intellisense not recognizing constexpr methods of captured values in lambda #4917

@lanyizi

Description

@lanyizi

Type: LanguageService

Describe the bug

  • OS and Version: Windows 10 18362
  • VS Code Version: 1.41.1
  • C/C++ Extension Version: 0.26.3
  • I have CMake tools installed

To Reproduce

  1. Write
auto array = std::array<int, 4>{};
array = [&array]{ return std::array<int, array.size()>{}; }();
  1. Intellisense will say "Expression must have constant value -- *this cannot be used as constant value"
    (For some reason my Intellisense won't give error messages in English, that error message above is translated from Chinese "表达式必须含有常量值 -- *this 的值不能用作常数")

Expected behavior

This shouldn't be flagged as an error since it's valid:

Screenshots

image

Additional context
Cpp Properties:

{
  "compilerPath": "C:/MyMinGW/i686-9.2.0-static-release-win32-dwarf-rt_v6/mingw32/bin/gcc.exe",
  "cStandard": "c11",
  "cppStandard": "c++17",
  "configurationProvider": "vector-of-bool.cmake-tools",
  "compileCommands": "${workspaceFolder}/build/compile_commands.json"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions