[LLVMbugs] [Bug 15801] New: illegal use of decltype in destructor silently accepted

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 20 15:45:49 PDT 2013


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

            Bug ID: 15801
           Summary: illegal use of decltype in destructor silently
                    accepted
           Product: clang
           Version: 3.1
          Hardware: PC
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mmehlich at semanticdesigns.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Source code:

extern "C" int printf(const char *, ...);

struct C {
    C *c;
    C() { printf("CREATE\n"); }
    ~decltype(*c)() { printf("DECLTYPE DESTROY\n"); }
    ~C() { printf("DESTROY\n"); }
};
int main() {
    C c{};
}

The line ~decltype(*c)()... should be reported as malformed as the destructor
must use the name of the destructor's class (12.4).

Using the compilation command
  clang -std=c++11 test.cpp -o out.exe -stdc++
the code does compile without any errors or warning.

The resulting executable calls the user-provided constructor C() 
but no user-provided destructor...

-- version of clang used:
>>> clang -v
clang version 3.1 (branches/release_31)
Target: i386-pc-cygwin
Thread model: posix

-- 
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/20130420/8d8cabd7/attachment.html>


More information about the llvm-bugs mailing list