<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 - delayed template parsing asserts on invalid constructor"
href="https://bugs.llvm.org/show_bug.cgi?id=50756">50756</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>delayed template parsing asserts on invalid constructor
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</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>erich.keane@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>I did a bit of digging, and it appears that the late-template-parsing happens,
but seems to not handle the error case and continues on. The late-parsing
results in no-body due to the error (I believe?), and thus the assert.
bash-4.2$ cat bug.cpp
class simd_storage {
float __storage_;
};
template <class _Tp>
struct simd {
simd_storage __s_;
simd(const float &__raw_simd) : __s_.__storage_(__raw_simd) {}
};
simd<float> SIMD_CALLEE() {
float data;
return simd<float>{ data };
}
bash-4.2$ ./bin/clang -cc1 bug.cpp -fdelayed-template-parsing
bug.cpp:9:39: error: expected '(' or '{'
simd(const float &__raw_simd) : __s_.__storage_(__raw_simd) {}
^
bug.cpp:9:39: error: expected member name or ';' after declaration specifiers
bug.cpp:15:2: error: expected '(' or '{'
}
^
clang:
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4871:
void clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool): Assertion `(Pattern ||
PatternDecl->isDefaulted() || PatternDecl->hasSkippedBody()) && "unexpected
kind of function template definition"' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: ./bin/clang -cc1 bug.cpp -fdelayed-template-parsing
1. <eof> parser at end of file
#0 0x000000000548e1cb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:22
#1 0x000000000548e282 PrintStackTraceSignalHandler(void*)
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
#2 0x000000000548c23f llvm::sys::RunSignalHandlers()
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/Signals.cpp:76:20
#3 0x000000000548dc13 SignalHandler(int)
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
#4 0x00007febb46995e0 __restore_rt sigaction.c:0:0
#5 0x00007febb32121f7 raise (/lib64/libc.so.6+0x351f7)
#6 0x00007febb32138e8 abort (/lib64/libc.so.6+0x368e8)
#7 0x00007febb320b266 __assert_fail_base (/lib64/libc.so.6+0x2e266)
#8 0x00007febb320b312 (/lib64/libc.so.6+0x2e312)
#9 0x00000000091b965d
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4869:3
#10 0x00000000091bdef0 clang::Sema::PerformPendingInstantiations(bool)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6210:32
#11 0x00000000085379a7
clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/Sema.cpp:1012:66
#12 0x0000000008537c03 clang::Sema::ActOnEndOfTranslationUnit()
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/Sema.cpp:1055:9
#13 0x00000000083e7d69
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/Parser.cpp:695:12
#14 0x00000000083e3575 clang::ParseAST(clang::Sema&, bool, bool)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/ParseAST.cpp:158:37
#15 0x000000000612c1ed clang::ASTFrontendAction::ExecuteAction()
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1058:11
#16 0x000000000612bb19 clang::FrontendAction::Execute()
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Frontend/FrontendAction.cpp:955:38
#17 0x000000000607636b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:977:42
#18 0x00000000062ab7e4
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#19 0x00000000025a0d29 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/iusers/ekeane1/workspaces/llvm-project/clang/tools/driver/cc1_main.cpp:246:40
#20 0x0000000002595e05 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/iusers/ekeane1/workspaces/llvm-project/clang/tools/driver/driver.cpp:338:20
#21 0x00000000025964d3 main
/iusers/ekeane1/workspaces/llvm-project/clang/tools/driver/driver.cpp:415:26
#22 0x00007febb31fec05 __libc_start_main (/lib64/libc.so.6+0x21c05)
#23 0x0000000002594679 _start (./bin/clang+0x2594679)
Aborted (core dumped)</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>