<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 - Crash on incorrect deduction guide"
href="https://bugs.llvm.org/show_bug.cgi?id=40444">40444</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Crash on incorrect deduction guide
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>7.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>C++'17
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>asynts@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21377" name="attach_21377" title="I was prompted to provide these files.">attachment 21377</a> <a href="attachment.cgi?id=21377&action=edit" title="I was prompted to provide these files.">[details]</a></span>
I was prompted to provide these files.
While experimenting with deduction guides I wrote the following (incorrect)
code:
template <typename _iter> void foo(_iter begin, _iter end) {
// suppress unused warning
(void)begin, (void)end;
}
template <typename _container> void foo(const _container &container) {
foo(container.begin(), container.end());
}
// doesn't make any sense
template <typename _container>
void foo(const _container &container)->foo<decltype(container)>;
int main() { foo({1, 2, 3}); }
Clang crashed with a Segmentation Fault in response:
main.cc:11:40: error: expected a type
void foo(const _container &container)->foo<decltype(container)>;
^
main.cc:11:1: error: function with trailing return type must specify return
type 'auto', not 'void'
void foo(const _container &container)->foo<decltype(container)>;
^~~~
main.cc:11:63: error: expected ';' at end of declaration
void foo(const _container &container)->foo<decltype(container)>;
^
;
Stack dump:
0. Program arguments: /usr/lib/llvm-7/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name main.cc -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/lib/llvm-7/lib/clang/7.0.1 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/backward
-internal-isystem /usr/include/clang/7.0.1/include/ -internal-isystem
/usr/local/include -internal-isystem /usr/lib/llvm-7/lib/clang/7.0.1/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++2a -fdeprecated-macro -fdebug-compilation-dir /tmp/tmp.62KMEmc37s
-ferror-limit 19 -fmessage-length 190 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/main-018846.o -x c++ main.cc -faddrsig
1. main.cc:11:64: current parser token ';'
#0 0x00007fd132bc2c2f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-7.so.1+0x9cec2f)
#1 0x00007fd132bc1160 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-7.so.1+0x9cd160)
#2 0x00007fd132bc2f42 (/usr/lib/x86_64-linux-gnu/libLLVM-7.so.1+0x9cef42)
#3 0x00007fd135c1b670 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12670)
#4 0x0000000001a6138f
clang::NestedNameSpecifier::containsUnexpandedParameterPack() const
(/usr/lib/llvm-7/bin/clang+0x1a6138f)
#5 0x00000000017bf731
clang::Sema::DiagnoseUnexpandedParameterPack(clang::CXXScopeSpec const&,
clang::Sema::UnexpandedParameterPackContext)
(/usr/lib/llvm-7/bin/clang+0x17bf731)
#6 0x00000000013925be clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
(/usr/lib/llvm-7/bin/clang+0x13925be)
#7 0x0000000001392468 clang::Sema::ActOnDeclarator(clang::Scope*,
clang::Declarator&) (/usr/lib/llvm-7/bin/clang+0x1392468)
#8 0x00000000010d2ff0
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/usr/lib/llvm-7/bin/clang+0x10d2ff0)
#9 0x00000000010d1d85 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/lib/llvm-7/bin/clang+0x10d1d85)
#10 0x00000000010baf4a
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/lib/llvm-7/bin/clang+0x10baf4a)
#11 0x00000000010ba938
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/lib/llvm-7/bin/clang+0x10ba938)
#12 0x00000000010b989c
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib/llvm-7/bin/clang+0x10b989c)
#13 0x00000000010b866e
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/lib/llvm-7/bin/clang+0x10b866e)
#14 0x00000000010b4187 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-7/bin/clang+0x10b4187)
#15 0x0000000000acdf0f clang::FrontendAction::Execute()
(/usr/lib/llvm-7/bin/clang+0xacdf0f)
#16 0x0000000000a8f238
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-7/bin/clang+0xa8f238)
#17 0x0000000000b5c426
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-7/bin/clang+0xb5c426)
#18 0x00000000006aa011 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-7/bin/clang+0x6aa011)
#19 0x00000000006a84a7 main (/usr/lib/llvm-7/bin/clang+0x6a84a7)
#20 0x00007fd131d3709b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#21 0x00000000006a5aca _start (/usr/lib/llvm-7/bin/clang+0x6a5aca)
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.1-4 (tags/RELEASE_701/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
I have a pretty unstable version of debian installed (called debian sid) that
might be related.</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>