[LLVMbugs] [Bug 9208] New: clang fails to reject invalid typeid expression and so crashes later on

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 13 12:52:06 PST 2011


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

           Summary: clang fails to reject invalid typeid expression and so
                    crashes later on
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: seth.cantrell at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


#include <typeinfo>

template<typename T> void foo() {};

int main() {
    typeid(foo<int>);
}

The above is invalid (at least according to g++) but since clang accepts it
clang tries to generate the type's name using its name mangling logic and
therefore hits the following assert:

Assertion failed: (false && "Overloaded and dependent types shouldn't get to
name mangling"), function mangleType, file ItaniumMangle.cpp, line 1303.

g++'s output is:

typeinfo_assert.c++: In function ‘int main()’:
typeinfo_assert.c++:6: error: insufficient contextual information to determine
type

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list