http://llvm.org/bugs/show_bug.cgi?id=9511
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: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
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 {
protected:
T value;
};
template <typename... T>
class Tuple: private Value<T>... {
public:
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
256.
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs