fun-parsing-confused.cpp:1:1: error: C++ requires a type specifier for all declarations fn1() { ^ fun-parsing-confused.cpp:2:12: error: expected a qualified name after 'typename' typename template fn2() { ^ fun-parsing-confused.cpp:2:27: error: function cannot be defined in an explicit instantiation; if this declaration is meant to be a function definition, remove the 'template' keyword typename template fn2() { ^ clang-3.6: /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Sema/SemaDecl.cpp:10057: clang::Decl *clang::Sema::ActOnStartOfFunctionDef(clang::Scope *, clang::Declarator &): Assertion `getCurFunctionDecl() == nullptr && "Function parsing confused"' failed. #0 0x7f19922f8130 llvm::sys::PrintStackTrace(_IO_FILE*) /home/sliedes/projects/llvm/llvm.src/lib/Support/Unix/Signals.inc:422:15 #1 0x7f19922fded3 SignalHandler(int) /home/sliedes/projects/llvm/llvm.src/lib/Support/Unix/Signals.inc:198:3 #2 0x7f198fbba180 (/lib/x86_64-linux-gnu/libc.so.6+0x35180) #3 0x7f198fbba107 gsignal /build/glibc-NmptCx/glibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0 #4 0x7f198fbbb4e8 abort /build/glibc-NmptCx/glibc-2.19/stdlib/abort.c:91:0 #5 0x7f198fbb3226 __assert_fail_base /build/glibc-NmptCx/glibc-2.19/assert/assert.c:92:0 #6 0x7f198fbb32d2 (/lib/x86_64-linux-gnu/libc.so.6+0x2e2d2) #7 0x7f198ac967bf (/home/sliedes/local/llvm-trunk-rel/bin/../lib/../lib/libclangSema.so+0x4a57bf) #8 0x7f198c06d9c0 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/Parser.cpp:1040:7 #9 0x7f198c034b45 clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseTemplate.cpp:271:12 #10 0x7f198c02ff5c clang::Parser::ParseExplicitInstantiation(unsigned int, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation&, clang::AccessSpecifier) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseTemplate.cpp:1261:10 #11 0x7f198c02fc19 clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseTemplate.cpp:34:12 #12 0x7f198be84608 clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseDecl.cpp:1352:18 #13 0x7f198c000b90 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseStmt.cpp:212:14 #14 0x7f198bffcb3f clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&, bool, clang::SourceLocation*) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseStmt.cpp:106:20 #15 0x7f198c017f77 clang::Parser::ParseCompoundStatementBody(bool) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseStmt.cpp:943:11 #16 0x7f198c01a413 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseStmt.cpp:1858:21 #17 0x7f198c06e050 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/Parser.cpp:1103:10 #18 0x7f198be9471e clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseDecl.cpp:1647:16 #19 0x7f198c06c0e0 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/Parser.cpp:893:10 #20 0x7f198c06a6ba clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/Parser.cpp:909:12 #21 0x7f198c06792b clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/Parser.cpp:637:12 #22 0x7f198c064431 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/Parser.cpp:569:12 #23 0x7f198be4a9cd clang::ParseAST(clang::Sema&, bool, bool) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Parse/ParseAST.cpp:135:7 #24 0x7f1990b98b81 clang::FrontendAction::Execute() /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Frontend/FrontendAction.cpp:428:8 #25 0x7f1990aeb488 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/Frontend/CompilerInstance.cpp:804:7 #26 0x7f19907552c3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/sliedes/projects/llvm/llvm.src/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222:18 #27 0x420258 cc1_main(llvm::ArrayRef, char const*, void*) /home/sliedes/projects/llvm/llvm.src/tools/clang/tools/driver/cc1_main.cpp:110:13 #28 0x419925 ExecuteCC1Tool(llvm::ArrayRef, llvm::StringRef) /home/sliedes/projects/llvm/llvm.src/tools/clang/tools/driver/driver.cpp:369:12 #29 0x419925 main /home/sliedes/projects/llvm/llvm.src/tools/clang/tools/driver/driver.cpp:415:0 #30 0x7f198fba6b45 __libc_start_main /build/glibc-NmptCx/glibc-2.19/csu/libc-start.c:321:0 #31 0x40b328 _start (/home/sliedes/local/llvm-trunk-rel/bin/clang-3.6+0x40b328) Stack dump: 0. Program arguments: /home/sliedes/local/llvm-trunk-rel/bin/clang-3.6 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name fun-parsing-confused.cpp -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 -resource-dir /home/sliedes/local/llvm-trunk-rel/bin/../lib/clang/3.6.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward -internal-isystem /usr/local/include -internal-isystem /home/sliedes/local/llvm-trunk-rel/bin/../lib/clang/3.6.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/sliedes/t/clang/bug/min -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /tmp/fun-parsing-confused-a445de.o -x c++ fun-parsing-confused.cpp 1. fun-parsing-confused.cpp:2:27: current parser token '{' 2. fun-parsing-confused.cpp:1:7: parsing function body 'fn1' 3. fun-parsing-confused.cpp:1:7: in compound statement ('{}') clang-3.6: error: unable to execute command: Aborted clang-3.6: error: clang frontend command failed due to signal (use -v to see invocation)