[LLVMbugs] [Bug 20686] New: No diagnostic for invalid destructor name where the class-name should not resolve to the injected-class-name

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Aug 16 12:23:41 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20686

            Bug ID: 20686
           Summary: No diagnostic for invalid destructor name where the
                    class-name should not resolve to the
                    injected-class-name
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

As confirmed by the resolution of Core Issue 244 (and dating back to C++98),
the lookup for the class-name "A" after the '~' below should be done in the
scope where the lookup for "AA" was done.
Since the lookup is performed prior to transformation into a class member
access expression (see 9.3.1 [class.mfct.non-static]), dual destructor lookup
(3.4.5 [basic.lookup.classref]) does not apply and the question raised in Core
Issue 399 does not arise.
A diagnostic is expected since ~A where the class-name resolves to M::A does
not name a member of N::A<int>.

Both GCC and EDG produce an error on this case.

### SOURCE:
$ cat nameADtor.cc 
namespace N {
   struct A { void selfDestruct(); };
}

namespace M {
   typedef N::A AA;
   union A;
}

void N::A::selfDestruct() {
   ::M::AA::~A();
}


### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -Wall -Wextra -pedantic-errors -x c++ -std=c++03 nameADtor.cc 
(No messages)


### EXPECTED BEHAVIOUR:
nameADtor.cc:11:14: error: expected the class name after '~' to name a
destructor
   ::M::AA::~A();
             ^
1 error generated.


### COMPILER VERSION INFO:
$ clang++ -v
clang version 3.5.0 (trunk 214060)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
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/20140816/4337725f/attachment.html>


More information about the llvm-bugs mailing list