<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang asserts in CodeGen with a lambda default argument function in a template"
href="https://bugs.llvm.org/show_bug.cgi?id=33092">33092</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang asserts in CodeGen with a lambda default argument function in a template
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>erik.pilkington@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Clang trunk (and dating back to 3.8) crashes on the following, compiled with
-std=c++14:
template<typename F> int algo(F fn) { return fn(); }
template<class X> void g(int n) {
int bef(int i = []{ return 1; }());
algo([=]{return n+bef();});
}
int main() { g<int>(0); }
With the stack trace:
Assertion failed: ((isGenericMethod || ((*I)->isVariablyModifiedType() ||
(*I).getNonReferenceType()->isObjCRetainableType() || getContext()
.getCanonicalType((*I).getNonReferenceType()) .getTypePtr() == getContext()
.getCanonicalType((*Arg)->getType()) .getTypePtr())) && "type mismatch in call
argument!"), function EmitCallArgs, file
/Users/erikpilkington/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h, line
3725.
0 clang-5.0 0x000000010d77e3fc
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1 clang-5.0 0x000000010d77e979
PrintStackTraceSignalHandler(void*) + 25
2 clang-5.0 0x000000010d77a8c9 llvm::sys::RunSignalHandlers() +
425
3 clang-5.0 0x000000010d77ed02 SignalHandler(int) + 354
4 libsystem_platform.dylib 0x00007fffb64b4bba _sigtramp + 26
5 libsystem_platform.dylib 000000000000000000 _sigtramp + 1236579424
6 libsystem_c.dylib 0x00007fffb633b420 abort + 129
7 libsystem_c.dylib 0x00007fffb6302893 basename_r + 0
8 clang-5.0 0x000000010dd1c28b void
clang::CodeGen::CodeGenFunction::EmitCallArgs<clang::FunctionProtoType>(clang::CodeGen::CallArgList&,
clang::FunctionProtoType const*,
llvm::iterator_range<clang::Stmt::ConstExprIterator>,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder) + 843
9 clang-5.0 0x000000010dd1b642
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType,
clang::CodeGen::CGCallee const&, clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot, llvm::Value*) + 4306
10 clang-5.0 0x000000010dd19fe8
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) + 776
11 clang-5.0 0x000000010dd6b5e3 (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) + 163
12 clang-5.0 0x000000010dd65f2b
clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 2939
13 clang-5.0 0x000000010dd5efa9 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*) + 73
14 clang-5.0 0x000000010dd70fb8 (anonymous
namespace)::ScalarExprEmitter::EmitBinOps(clang::BinaryOperator const*) + 104
15 clang-5.0 0x000000010dd67448 (anonymous
namespace)::ScalarExprEmitter::VisitBinAdd(clang::BinaryOperator const*) + 40
16 clang-5.0 0x000000010dd654b3
clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 259
17 clang-5.0 0x000000010dd5efa9 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*) + 73
18 clang-5.0 0x000000010dd5ef0d
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 189
19 clang-5.0 0x000000010de7edc4
clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) + 948
20 clang-5.0 0x000000010de7bda1
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 993
21 clang-5.0 0x000000010de8bea8
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 136
22 clang-5.0 0x000000010defba52
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 146
23 clang-5.0 0x000000010defc62a
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1418
24 clang-5.0 0x000000010df24b1e
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 574
25 clang-5.0 0x000000010df1c9cc
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 588
26 clang-5.0 0x000000010df12669
clang::CodeGen::CodeGenModule::EmitDeferred() + 1097
27 clang-5.0 0x000000010df126c5
clang::CodeGen::CodeGenModule::EmitDeferred() + 1189
28 clang-5.0 0x000000010df126c5
clang::CodeGen::CodeGenModule::EmitDeferred() + 1189
29 clang-5.0 0x000000010df10b06
clang::CodeGen::CodeGenModule::Release() + 54
30 clang-5.0 0x000000010e0e9be6 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) + 166
31 clang-5.0 0x000000010dee5dcc
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 220
32 clang-5.0 0x000000010fba8186 clang::ParseAST(clang::Sema&,
bool, bool) + 1238
33 clang-5.0 0x000000010e5cce95
clang::ASTFrontendAction::ExecuteAction() + 485
34 clang-5.0 0x000000010dee53c5
clang::CodeGenAction::ExecuteAction() + 5509
35 clang-5.0 0x000000010e5cbf20 clang::FrontendAction::Execute()
+ 112
36 clang-5.0 0x000000010e4f39e6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 2278
37 clang-5.0 0x000000010e66797c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 5836
38 clang-5.0 0x000000010a4280d2 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 4914
39 clang-5.0 0x000000010a4177ee
ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) + 622
40 clang-5.0 0x000000010a4149e9 main + 4457
41 libdyld.dylib 0x00007fffb62a7255 start + 1
42 libdyld.dylib 0x0000000000000034 start + 1238732256</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>