http://llvm.org/bugs/show_bug.cgi?id=21484
Bug ID: 21484
Summary: Clang crashes on lambdas with arguments of invalid
types derived from template arguments
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Code:
template<class T>
void bar(T t) {
auto x = [](typename T::ns::type &k) {};
}
class S {};
void foo() {
bar(5);
bar(S());
}
Commandline:
clang -std=c++11 test.cc
Error:
bar(5) produces:
test.cc:3:24: error: type 'int' cannot be used prior to '::' because it has no
members
auto x = [](typename T::ns::type &k) {};
^
test.cc:9:3: note: in instantiation of function template specialization
'bar<int>' requested here
bar(5);
^
bar(S()) [with bar(5) commented out] produces:
test.cc:3:27: error: no member named 'ns' in 'S'
auto x = [](typename T::ns::type &k) {};
~~~^
test.cc:10:3: note: in instantiation of function template specialization
'bar<S>' requested here
bar(S());
^
Assertion:
clang-3.6: ../tools/clang/lib/Sema/TypeLocBuilder.h:106: clang::TypeSourceInfo
*clang::TypeLocBuilder::getTypeSourceInfo(clang::ASTContext &,
clang::QualType): Assertion `T == LastTy && "type doesn't match last type
pushed!"' failed.
QualType T in the assertion is a null QualType.
I suspect that TransformLambdaExpr (which calls getTypeSoucreInfo at lint 9017
and triggers the assertion) is not handling invalid types properly along all
paths.
--
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