[llvm-bugs] [Bug 43966] New: Clang compiler failed with error: expected the class name after '~' to name a destructor

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 11 09:42:31 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=43966

            Bug ID: 43966
           Summary: Clang compiler failed with error: expected the class
                    name after '~' to name a destructor
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: soumi.manna at intel.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

EDG, GCC, and MSVC all compile the test case below and generated a call to
AAA::BBB::~BBB(void) where clang fails with error: expected the class name
after '~' to name a destructor.

-bash-4.2$ clang++ -c -std=c++11 t.cpp
t.cpp:19:28: error: expected the class name after '~' to name a destructor
    ptr1->AAA::BBB_alias::~BBB_alias(); // Error
                           ^
1 error generated.

-bash-4.2$ g++ -c -std=c++11 t.cpp
-bash-4.2$

-bash-4.2$ cat t.cpp
struct AAA
{
    struct BBB
    {
        ~BBB() {}
    };

    typedef BBB BBB_alias;
};

typedef AAA::BBB BBB_alias2;

int
main()
{
    AAA::BBB_alias *ptr1 = new AAA::BBB_alias();
    AAA::BBB_alias *ptr2 = new AAA::BBB_alias();

    ptr1->AAA::BBB_alias::~BBB_alias(); // Error
    ptr2->AAA::BBB_alias::~BBB();       // OK
    ptr1->~BBB_alias2();                // OK
    return 0;
}

Thanks,
Soumi
Intel C++ Compiler

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191111/1485a389/attachment.html>


More information about the llvm-bugs mailing list