[llvm-bugs] [Bug 43113] New: Crash on missing typename in trailing return type

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 26 01:44:22 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43113

            Bug ID: 43113
           Summary: Crash on missing typename in trailing return type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sammccall at google.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

This appears to be pretty old, clang-7 crashes on it too.

$ cat test.cc
template <typename T> auto foo() -> T::template NestedTemplate<int>;

$ clang -fsyntax-only test.cc
/usr/local/google/home/sammccall/temp/test.cc:1:37: error: expected a type
template <typename T> auto foo() -> T::template NestedTemplate<int>;
                                    ^
/usr/local/google/home/sammccall/temp/test.cc:1:40: error: expected ';' at end
of declaration
template <typename T> auto foo() -> T::template NestedTemplate<int>;
                                       ^
                                       ;
/usr/local/google/home/sammccall/temp/test.cc:1:40: error: 'template' keyword
not permitted here
template <typename T> auto foo() -> T::template NestedTemplate<int>;
                                       ^~~~~~~~~
Stack dump:
0.      Program arguments:
/usr/local/google/home/sammccall/llvmbuild-mono/bin/clang-10 -cc1 -triple
x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name test.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/local/google/home/sammccall/llvmbuild-mono/lib/clang/9.0.0
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/google/home/sammccall/llvmbuild-mono/lib/clang/9.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir
/usr/local/google/home/sammccall/src/llvm-mono -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -faddrsig -x c++
/usr/local/google/home/sammccall/temp/test.cc 
1.      /usr/local/google/home/sammccall/temp/test.cc:1:68: current parser
token ';'
 #0 0x0000000002457b84 PrintStackTrace
/usr/local/google/home/sammccall/src/llvm-mono/llvm/lib/Support/Unix/Signals.inc:494:13
 #1 0x0000000002457b84 PrintStackTraceSignalHandler(void*)
/usr/local/google/home/sammccall/src/llvm-mono/llvm/lib/Support/Unix/Signals.inc:554:0
 #2 0x000000000245579e llvm::sys::RunSignalHandlers()
/usr/local/google/home/sammccall/src/llvm-mono/llvm/lib/Support/Signals.cpp:69:18
 #3 0x0000000002457f98 SignalHandler(int)
/usr/local/google/home/sammccall/src/llvm-mono/llvm/lib/Support/Unix/Signals.inc:357:1
 #4 0x00007f297ed2e3a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x123a0)
 #5 0x00000000045ae292 getTemplateDecl
/usr/local/google/home/sammccall/src/llvm-mono/clang/include/clang/AST/TemplateName.h:420:50
 #6 0x00000000045ae292 clang::TemplateName::getAsTemplateDecl() const
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/AST/TemplateName.cpp:104:0
 #7 0x00000000042d3845
clang::ASTContext::getNameForTemplate(clang::TemplateName,
clang::SourceLocation) const
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/AST/ASTContext.cpp:5247:37
 #8 0x0000000003bd8653
clang::Sema::GetNameFromUnqualifiedId(clang::UnqualifiedId const&)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Sema/SemaDecl.cpp:5104:20
 #9 0x0000000003bd8af4 isValid
/usr/local/google/home/sammccall/src/llvm-mono/clang/include/clang/Basic/SourceLocation.h:106:36
#10 0x0000000003bd8af4 isSet
/usr/local/google/home/sammccall/src/llvm-mono/clang/include/clang/Sema/DeclSpec.h:1715:0
#11 0x0000000003bd8af4 isDecompositionDeclarator
/usr/local/google/home/sammccall/src/llvm-mono/clang/include/clang/Sema/DeclSpec.h:2134:0
#12 0x0000000003bd8af4 clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Sema/SemaDecl.cpp:5377:0
#13 0x0000000003bd8a48 clang::Sema::ActOnDeclarator(clang::Scope*,
clang::Declarator&)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Sema/SemaDecl.cpp:5236:15
#14 0x00000000039d3ff0 getCurScope
/usr/local/google/home/sammccall/src/llvm-mono/clang/include/clang/Sema/Sema.h:11083:39
#15 0x00000000039d3ff0 getCurScope
/usr/local/google/home/sammccall/src/llvm-mono/clang/include/clang/Parse/Parser.h:410:0
#16 0x00000000039d3ff0
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Parse/ParseDecl.cpp:2254:0
#17 0x00000000039d2e4c clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Parse/ParseDecl.cpp:2098:21
#18 0x00000000039b91b5
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Parse/Parser.cpp:1095:10
#19 0x00000000039b8bd5
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Parse/Parser.cpp:1111:12
#20 0x00000000039b7cca
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Parse/Parser.cpp:931:12
#21 0x00000000039b5cd3
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Parse/Parser.cpp:682:10
#22 0x00000000039b1448 clang::ParseAST(clang::Sema&, bool, bool)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Parse/ParseAST.cpp:157:5
#23 0x0000000002b4819d clang::FrontendAction::Execute()
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Frontend/FrontendAction.cpp:938:10
#24 0x0000000002aea3a8 getPtr
/usr/local/google/home/sammccall/src/llvm-mono/llvm/include/llvm/Support/Error.h:273:42
#25 0x0000000002aea3a8 operator bool
/usr/local/google/home/sammccall/src/llvm-mono/llvm/include/llvm/Support/Error.h:236:0
#26 0x0000000002aea3a8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/Frontend/CompilerInstance.cpp:944:0
#27 0x0000000002be95ac
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/usr/local/google/home/sammccall/src/llvm-mono/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:291:25
#28 0x00000000009e38bf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/usr/local/google/home/sammccall/src/llvm-mono/clang/tools/driver/cc1_main.cpp:249:15
#29 0x00000000009e149c ExecuteCC1Tool
/usr/local/google/home/sammccall/src/llvm-mono/clang/tools/driver/driver.cpp:309:12
#30 0x00000000009e149c main
/usr/local/google/home/sammccall/src/llvm-mono/clang/tools/driver/driver.cpp:381:0
#31 0x00007f297dda952b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2352b)
#32 0x00000000009de66a _start
(/usr/local/google/home/sammccall/llvmbuild-mono/bin/clang-10+0x9de66a)
clang-10: error: unable to execute command: Segmentation fault
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (https://github.com/llvm/llvm-project
fa9d232e4389bbd9ca82f8b6b34a1784107835fc)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/google/home/sammccall/llvmbuild-mono/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-10: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/test-c5d909.cpp
clang-10: note: diagnostic msg: /tmp/test-c5d909.sh
clang-10: note: diagnostic msg: 

********************

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190826/add060ea/attachment.html>


More information about the llvm-bugs mailing list