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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to