<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 crashes (Segmentation fault): template argument deduction + typo in template declaration"
href="https://bugs.llvm.org/show_bug.cgi?id=52026">52026</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang crashes (Segmentation fault): template argument deduction + typo in template declaration
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>varqox@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=25311" name="attach_25311" title="Contains /tmp/abc-dbf30b.cpp and /tmp/abc-dbf30b.sh">attachment 25311</a> <a href="attachment.cgi?id=25311&action=edit" title="Contains /tmp/abc-dbf30b.cpp and /tmp/abc-dbf30b.sh">[details]</a></span>
Contains /tmp/abc-dbf30b.cpp and /tmp/abc-dbf30b.sh
Source (file abc.cc):
```cpp
template<class T>
struct Foo {
template<class X...> // Notice the typo, should be template<class... X>
Foo();
};
Foo x{};
```
Compilation command: clang++ abc.cc -std=c++17
System: Arch Linux
Compiler output:
abc.cc:3:21: error: non-type template parameter has incomplete type 'class X'
template<class X...> // Notice the typo, should be template<class... X>
^
abc.cc:3:17: note: forward declaration of 'X'
template<class X...> // Notice the typo, should be template<class... X>
^
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: /usr/bin/clang-12 -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all --mrelax-relocations -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name abc.cc -mrelocation-model pic -pic-level 2
-pic-is-pie -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic
-fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/usr/lib/clang/12.0.1 -internal-isystem
/usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../include/c++/11.1.0
-internal-isystem
/usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../include/c++/11.1.0/x86_64-pc-linux-gnu
-internal-isystem
/usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../include/c++/11.1.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/clang/12.0.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++17 -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -stack-protector 2
-fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics
-faddrsig -o /tmp/abc-7a6160.o -x c++ abc.cc
1. abc.cc:7:8: current parser token ';'
#0 0x00007fb4832e8793 (/usr/bin/../lib/libLLVM-12.so+0xb49793)
#1 0x00007fb4832e5e96 (/usr/bin/../lib/libLLVM-12.so+0xb46e96)
#2 0x00007fb4823f9da0 __restore_rt (/usr/bin/../lib/libc.so.6+0x3cda0)
#3 0x00007fb48a1b39e0
clang::Sema::DeclareImplicitDeductionGuides(clang::TemplateDecl*,
clang::SourceLocation) (/usr/bin/../lib/libclang-cpp.so.12+0x17699e0)
#4 0x00007fb489f9408a (/usr/bin/../lib/libclang-cpp.so.12+0x154a08a)
#5 0x00007fb489f94a85 clang::Sema::LookupQualifiedName(clang::LookupResult&,
clang::DeclContext*, bool) (/usr/bin/../lib/libclang-cpp.so.12+0x154aa85)
#6 0x00007fb489f50846
clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>)
(/usr/bin/../lib/libclang-cpp.so.12+0x1506846)
#7 0x00007fb489c339f4
clang::Sema::deduceVarTypeFromInitializer(clang::VarDecl*,
clang::DeclarationName, clang::QualType, clang::TypeSourceInfo*,
clang::SourceRange, bool, clang::Expr*)
(/usr/bin/../lib/libclang-cpp.so.12+0x11e99f4)
#8 0x00007fb489c4ea9b
clang::Sema::DeduceVariableDeclarationType(clang::VarDecl*, bool, clang::Expr*)
(/usr/bin/../lib/libclang-cpp.so.12+0x1204a9b)
#9 0x00007fb489c5208e clang::Sema::AddInitializerToDecl(clang::Decl*,
clang::Expr*, bool) (/usr/bin/../lib/libclang-cpp.so.12+0x120808e)
#10 0x00007fb4893999c6
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/usr/bin/../lib/libclang-cpp.so.12+0x94f9c6)
#11 0x00007fb4893aa0c4 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/bin/../lib/libclang-cpp.so.12+0x9600c4)
#12 0x00007fb4894691e5 (/usr/bin/../lib/libclang-cpp.so.12+0xa1f1e5)
#13 0x00007fb48946f8ae
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/bin/../lib/libclang-cpp.so.12+0xa258ae)
#14 0x00007fb48947092a
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/usr/bin/../lib/libclang-cpp.so.12+0xa2692a)
#15 0x00007fb489381432 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/bin/../lib/libclang-cpp.so.12+0x937432)
#16 0x00007fb48adcc2b9 clang::FrontendAction::Execute()
(/usr/bin/../lib/libclang-cpp.so.12+0x23822b9)
#17 0x00007fb48ad635be
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/bin/../lib/libclang-cpp.so.12+0x23195be)
#18 0x00007fb48ae4c999
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/bin/../lib/libclang-cpp.so.12+0x2402999)
#19 0x00005573b78c18de cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/bin/clang-12+0x128de)
#20 0x00005573b78beee8 (/usr/bin/clang-12+0xfee8)
#21 0x00005573b78bb505 main (/usr/bin/clang-12+0xc505)
#22 0x00007fb4823e4b25 __libc_start_main (/usr/bin/../lib/libc.so.6+0x27b25)
#23 0x00005573b78be86e _start (/usr/bin/clang-12+0xf86e)
clang-12: error: unable to execute command: Segmentation fault
clang-12: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/sbin
clang-12: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /tmp/abc-dbf30b.cpp
clang-12: note: diagnostic msg: /tmp/abc-dbf30b.sh
clang-12: note: diagnostic msg:
********************</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>