microsoft / microsoft/vscode-cpptools

constexpr destructors not recognized

Offen
#7,965 4 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@michelleangela arbeitet bereits daran.

Seit 10.9.2021.

bug Language Service Visual Studio
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

Bug type: Language Service

Describe the bug

  • OS and Version: Windows 10 Pro 20H2
  • VS Code Version: 1.59.0
  • C/C++ Extension Version: 1.5.1
  • Other extensions you installed (and if the issue persists after disabling them): None
  • If using SSH remote, specify OS of remote machine: -
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc):

main.cpp:

struct Foo
{
    constexpr ~Foo() { }  // when you comment this out, everything is fine
};

constexpr auto cfoo = Foo();  // "Foo::~Foo" not defined
auto foo = Foo();            // this is ok though

int main()
{
    return 0;
}

When I put a custom constexpr destructor in a class, as C++20 now allows us to do, Intellisense says it were not defined.

To reproduce, use above code.

GCC 10.2 (both from recent Mingw and from the Gnu Arm Embedded Toolchain) compiles this code without issues.

Expected behavior is that Intellisense would not issue an error here.

settings.json:

{
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}

No other files present, except for an CMakeLists.txt

cmake_minimum_required(VERSION 3.13.1)
project(FooExample VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)

add_executable(app)

target_sources(app PRIVATE
    "main.cpp"
)

I used cmake 3.17.5 to configure and Ninja to build.

Screenshot: (my Intellisense is in german though)
FooExample

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.