[LLVMbugs] [Bug 9511] New: Crash on invalid variadic template code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 19 00:25:57 PDT 2011


           Summary: Crash on invalid variadic template code
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Created an attachment (id=6345)
 --> (http://llvm.org/bugs/attachment.cgi?id=6345)
The complete stacktrace/output of clang

The following (invalid) code results in a crash of clang:

template <typename T>
class Value {
        T    value;

template <typename... T>
class Tuple: private Value<T>... {
        template <typename V>
        V& get()
            // <T> should be <V>
            return this->Value<T>::value;

int main(int, char**)
    Tuple<int, char, float>    t;
    return t.get<int>();

This results in (complete output in the attachment):

$ /opt/bin/clang -std=c++0x clangBugs.cpp 
clangBugs.cpp:14:11: error: cannot compile this l-value expression yet
                        return this->Value<T>::value;
Assertion failed: (0 && "Unexpected builtin type!"), function ConvertNewType,
file /Users/rynnsauer/LLVM/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp, line

My clang version:

$ /opt/bin/clang --version
clang version 2.9 (trunk 127156)
Target: x86_64-apple-darwin10
Thread model: posix

While clang should display an error, as the code is (obviously) invalid, it
should not crash.

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