Skip to content

-Wdtor-name incorrect on inner class #46323

@JVApen

Description

@JVApen
Bugzilla Link 46979
Version 11.0
OS Windows NT
CC @dwblaikie,@zmodem,@JVApen,@poletti-marco,@zygoloid

Extended Description

See https://compiler-explorer.com/z/vY5xo8

// clang++ -Wdtor-name t.cpp
class A
{
    template <typename T>
    class B;
};

template<typename T>
class A::B
{
    ~B();
};

template<typename T>
A::B<T>::~B()
{

}

// Result:

<source>:14:8: warning: ISO C++ requires the name after '::~' to be found in the same scope as the name before '::~' [-Wdtor-name]

A::B<T>::~B()

~~~~~~~^~

       ::B

As far as I can see, this code is correct and this warning is giving a false positive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions