[llvm-bugs] [Bug 25022] New: A void* handler doesn't catch nullptr_t, violating 15.3p3.4

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 1 20:18:07 PDT 2015


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

            Bug ID: 25022
           Summary: A void* handler doesn't catch nullptr_t, violating
                    15.3p3.4
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.vul at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Given the testcase:

// begin throw-nullptr.cc
extern "C" int puts(const char *);

int main() {
    try {
        throw nullptr;
    } catch (void *) {
        puts("catch void*");
    } catch (...) {
        puts("catch ...");
    }
}
// end throw-nullptr.cc

and invocation

clang++ -std=c++11 throw-nullptr.cc && ./a.out

the output "catch void*" is expected due to 15.3p3.4 (aka [except.handle]/3.4)

"A handler is a match for an exception object of type E if ... the handler is
of type cv T or const T& where T is a pointer or pointer to member type and E
is
std::nullptr_t."


But catch(...) is used instead, as if the nullptr_t -> pointer conversion was
omitted during computation of which catch-block to use.

-- 
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/20151002/e8f03673/attachment.html>


More information about the llvm-bugs mailing list