[llvm-bugs] [Bug 44159] New: Parser assertion: `SS.isEmpty() && "undeclared non-type annotation should be unqualified"'

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 27 01:53:35 PST 2019


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

            Bug ID: 44159
           Summary: Parser assertion: `SS.isEmpty() && "undeclared
                    non-type annotation should be unqualified"'
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arichardson.kde at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The following reduced test case results in a crash:
```
// RUN: %clang_cc1 -fsyntax-only %s
class a
  template b< a :c(
```


```
/local/scratch/alr48/cheri/upstream-llvm-project/clang/test/Parser/new-test.cpp:3:8:
error: expected ';' after class
class a
       ^
       ;
/local/scratch/alr48/cheri/upstream-llvm-project/clang/test/Parser/new-test.cpp:4:17:
error: unexpected ':' in nested name specifier; did you mean '::'?
  template b< a :c(
                ^
                ::
/local/scratch/alr48/cheri/upstream-llvm-project/clang/test/Parser/new-test.cpp:4:15:
error: incomplete type 'a' named in nested name specifier
  template b< a :c(
              ^~~
/local/scratch/alr48/cheri/upstream-llvm-project/clang/test/Parser/new-test.cpp:3:7:
note: forward declaration of 'a'
class a
      ^
/local/scratch/alr48/cheri/upstream-llvm-project/clang/test/Parser/new-test.cpp:4:12:
error: no template named 'b'
  template b< a :c(
           ^
clang:
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseExprCXX.cpp:585:
clang::ExprResult clang::Parser::tryParseCXXIdExpression(clang::CXXScopeSpec &,
bool, clang::Token &): Assertion `SS.isEmpty() && "undeclared non-type
annotation should be unqualified"' failed.
Stack dump:
0.      Program arguments:
/local/scratch/alr48/cheri/build/upstream-llvm-project-build/bin/clang -cc1
-internal-isystem
/local/scratch/alr48/cheri/build/upstream-llvm-project-build/lib/clang/10.0.0/include
-nostdsysteminc -fsyntax-only
/local/scratch/alr48/cheri/upstream-llvm-project/clang/test/Parser/new-test.cpp
1.     
/local/scratch/alr48/cheri/upstream-llvm-project/clang/test/Parser/new-test.cpp:4:18:
at annotation token
 #0 0x0000000004655b34 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/local/scratch/alr48/cheri/upstream-llvm-project/llvm/lib/Support/Unix/Signals.inc:548:13
 #1 0x0000000004655b34 PrintStackTraceSignalHandler(void*)
/local/scratch/alr48/cheri/upstream-llvm-project/llvm/lib/Support/Unix/Signals.inc:608:0
 #2 0x00000000046537ee llvm::sys::RunSignalHandlers()
/local/scratch/alr48/cheri/upstream-llvm-project/llvm/lib/Support/Signals.cpp:69:18
 #3 0x0000000004655f56 SignalHandler(int)
/local/scratch/alr48/cheri/upstream-llvm-project/llvm/lib/Support/Unix/Signals.inc:390:1
 #4 0x00007ff63a420890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x00007ff638ec9e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #6 0x00007ff638ecb801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #7 0x00007ff638ebb39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #8 0x00007ff638ebb412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #9 0x000000000582cce4
(/local/scratch/alr48/cheri/build/upstream-llvm-project-build/bin/clang+0x582cce4)
#10 0x000000000582df0e clang::Parser::ParseCXXIdExpression(bool)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseExprCXX.cpp:672:7
#11 0x000000000583be39 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState, bool)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseExpr.cpp:0:0
#12 0x000000000583b5dd clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState, bool)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseExpr.cpp:533:20
#13 0x000000000583b5dd
clang::Parser::ParseConstantExpressionInExprEvalContext(clang::Parser::TypeCastState)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseExpr.cpp:205:0
#14 0x0000000005886211 clang::Parser::ParseTemplateArgument()
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseTemplate.cpp:1368:27
#15 0x00000000058858ed clang::Token::isNot(clang::tok::TokenKind) const
/local/scratch/alr48/cheri/upstream-llvm-project/clang/include/clang/Lex/Token.h:98:52
#16 0x00000000058858ed clang::Parser::TryConsumeToken(clang::tok::TokenKind)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/include/clang/Parse/Parser.h:457:0
#17 0x00000000058858ed clang::Parser::TryConsumeToken(clang::tok::TokenKind,
clang::SourceLocation&)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/include/clang/Parse/Parser.h:467:0
#18 0x00000000058858ed
clang::Parser::ParseTemplateArgumentList(llvm::SmallVector<clang::ParsedTemplateArgument,
16u>&)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseTemplate.cpp:1389:0
#19 0x00000000058857cc clang::Parser::ParseTemplateIdAfterTemplateName(bool,
clang::SourceLocation&, llvm::SmallVector<clang::ParsedTemplateArgument, 16u>&,
clang::SourceLocation&)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseTemplate.cpp:1054:9
#20 0x00000000058164a1
llvm::SmallVectorTemplateCommon<clang::ParsedTemplateArgument, void>::begin()
/local/scratch/alr48/cheri/upstream-llvm-project/llvm/include/llvm/ADT/SmallVector.h:127:45
#21 0x00000000058164a1 llvm::SmallVector<clang::ParsedTemplateArgument,
16u>::~SmallVector()
/local/scratch/alr48/cheri/upstream-llvm-project/llvm/include/llvm/ADT/SmallVector.h:843:0
#22 0x00000000058164a1 clang::Parser::ParseImplicitInt(clang::DeclSpec&,
clang::CXXScopeSpec*, clang::Parser::ParsedTemplateInfo const&,
clang::AccessSpecifier, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseDecl.cpp:2776:0
#23 0x0000000005811534
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseDecl.cpp:3379:13
#24 0x0000000005881e0f clang::Token::is(clang::tok::TokenKind) const
/local/scratch/alr48/cheri/upstream-llvm-project/clang/include/clang/Lex/Token.h:97:49
#25 0x0000000005881e0f
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseTemplate.cpp:216:0
#26 0x0000000005880c25
clang::Parser::ParseExplicitInstantiation(clang::DeclaratorContext,
clang::SourceLocation, clang::SourceLocation, clang::SourceLocation&,
clang::ParsedAttributes&, clang::AccessSpecifier)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseTemplate.cpp:1424:10
#27 0x0000000005880ab0
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseTemplate.cpp:0:0
#28 0x000000000580e5df
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseDecl.cpp:1787:10
#29 0x00000000057e4260
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/Parser.cpp:0:3
#30 0x00000000057e2ae6
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/Parser.cpp:682:10
#31 0x00000000057de098 clang::ParseAST(clang::Sema&, bool, bool)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Parse/ParseAST.cpp:157:5
#32 0x0000000004ec2d50 clang::FrontendAction::Execute()
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Frontend/FrontendAction.cpp:940:10
#33 0x0000000004e1e3f4 llvm::Error::getPtr() const
/local/scratch/alr48/cheri/upstream-llvm-project/llvm/include/llvm/Support/Error.h:273:42
#34 0x0000000004e1e3f4 llvm::Error::operator bool()
/local/scratch/alr48/cheri/upstream-llvm-project/llvm/include/llvm/Support/Error.h:236:0
#35 0x0000000004e1e3f4
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/Frontend/CompilerInstance.cpp:964:0
#36 0x0000000004f72ac3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290:25
#37 0x0000000002954157 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/tools/driver/cc1_main.cpp:250:15
#38 0x0000000002951d54 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/local/scratch/alr48/cheri/upstream-llvm-project/clang/tools/driver/driver.cpp:309:12
#39 0x0000000002951d54 main
/local/scratch/alr48/cheri/upstream-llvm-project/clang/tools/driver/driver.cpp:382:0
#40 0x00007ff638eacb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#41 0x000000000294f02a _start
(/local/scratch/alr48/cheri/build/upstream-llvm-project-build/bin/clang+0x294f02a)
```

-- 
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/20191127/26078efd/attachment-0001.html>


More information about the llvm-bugs mailing list