Skip to content

C++: Clang allows a wrongly-named destructor in Templates. #56772

Closed
@JFinis

Description

@JFinis

The following code compiles fine on clang (14.0 and latest trunk), even though the destructor of Foobar is not called ~Foobar but ~Node. GCC reports an error as expected.

struct Node {}; 
template <int x> 
struct Foobar { ~Node() {} }; 
Foobar<5> f{};

https://godbolt.org/z/T8jTrPYW1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions