[llvm-bugs] [Bug 49735] New: ICE on invalid: llvm::cast assert-fails in ParseLexedMethodDeclaration

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 26 20:04:52 PDT 2021


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

            Bug ID: 49735
           Summary: ICE on invalid: llvm::cast assert-fails in
                    ParseLexedMethodDeclaration
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arthur.j.odwyer at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

cat >test.cpp <<EOF
template<class> struct B;
struct A { B() noexcept(false); };
EOF
clang++ -std=c++17 -w -c test.cpp


The compiler assert-fails in llvm::cast.
(This requires that you compile Clang in Debug mode.)

===========

test.cpp:2:12: error: deduction guide must be declared in the same scope as
template 'B'
struct A { B() noexcept(false); };
           ^
test.cpp:1:24: note: template is declared here
template<class> struct B;
                       ^
test.cpp:2:12: error: deduction guide declaration without trailing return type
struct A { B() noexcept(false); };
           ^
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file
/Users/aodwyer/llvm-project/llvm/include/llvm/Support/Casting.h, line 269.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /Users/aodwyer/llvm-project/build-debug/bin/clang++
-std=c++17 -w -c test.cpp
1.      test.cpp:2:16: current parser token 'noexcept'
2.      test.cpp:2:1: parsing struct/union/class body 'A'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH
or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  clang++                  0x000000010ef9b63d
llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 61
1  clang++                  0x000000010ef9bbbb
PrintStackTraceSignalHandler(void*) + 27
2  clang++                  0x000000010ef99b13 llvm::sys::RunSignalHandlers() +
115
3  clang++                  0x000000010ef9aede
llvm::sys::CleanupOnSignal(unsigned long) + 110
4  clang++                  0x000000010ee39b20 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) + 192
5  clang++                  0x000000010ee39e73 CrashRecoverySignalHandler(int)
+ 195
6  libsystem_platform.dylib 0x00007fff697a5b5d _sigtramp + 29
7  libsystem_platform.dylib 0x00007ffee4716828 _sigtramp + 18446744071477595368
8  libsystem_c.dylib        0x00007fff6965f6a6 abort + 127
9  libsystem_c.dylib        0x00007fff6962820d basename_r + 0
10 clang++                  0x0000000114289f15
llvm::cast_retty<clang::CXXMethodDecl, clang::Decl*>::ret_type
llvm::cast<clang::CXXMethodDecl, clang::Decl>(clang::Decl*) + 101
11 clang++                  0x00000001127eef88
clang::Parser::ParseLexedMethodDeclaration(clang::Parser::LateParsedMethodDeclaration&)
+ 2712
12 clang++                  0x00000001127ee4e9
clang::Parser::LateParsedMethodDeclaration::ParseLexedMethodDeclarations() + 25
13 clang++                  0x00000001127ee10a
clang::Parser::ParseLexedMethodDeclarations(clang::Parser::ParsingClass&) + 106
14 clang++                  0x0000000112822def
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 3343
15 clang++                  0x0000000112820b78
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 9720
16 clang++                  0x00000001127ff4c3
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 15395
17 clang++                  0x00000001128e09d8
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 136
18 clang++                  0x00000001128e0522
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 194
19 clang++                  0x00000001128df61f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 3551
20 clang++                  0x00000001128dd6bb
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
+ 1739
21 clang++                  0x00000001127ea5e4 clang::ParseAST(clang::Sema&,
bool, bool) + 580
22 clang++                  0x0000000110030e8c
clang::ASTFrontendAction::ExecuteAction() + 300
23 clang++                  0x000000010f96955a
clang::CodeGenAction::ExecuteAction() + 90
24 clang++                  0x00000001100304bc clang::FrontendAction::Execute()
+ 124
25 clang++                  0x000000010ff4a2e8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 920
26 clang++                  0x000000011013972e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1614
27 clang++                  0x000000010b4f363d cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 1501
28 clang++                  0x000000010b4e5e3b
ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 427
29 clang++                  0x000000010fd014c5
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >*, bool*) const::$_1::operator()() const + 37
30 clang++                  0x000000010fd01495 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >*, bool*) const::$_1>(long) + 21
31 clang++                  0x000000010ee399b9 llvm::function_ref<void
()>::operator()() const + 25
32 clang++                  0x000000010ee3995c
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 236
33 clang++                  0x000000010fcfff5c
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >*, bool*) const + 524
34 clang++                  0x000000010fcaa406
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const + 758
35 clang++                  0x000000010fcaa6c8
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&)
const + 152
36 clang++                  0x000000010fcc54f5
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) +
325
37 clang++                  0x000000010b4e538b main + 3371
38 libdyld.dylib            0x00007fff695ba3d5 start + 1
39 libdyld.dylib            0x0000000000000005 start + 18446603338748550193
clang-13: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
clang version 13.0.0 (git at github.com:Quuxplusone/llvm-project
4adea96d9486bb19440243420ba234c1916907c9)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Users/aodwyer/llvm-project/build-debug/bin
clang-13: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg:
/var/folders/0l/9t0yv2890_g4wgmy53n_mg7w0000gy/T/test-55cfcb.cpp
clang-13: note: diagnostic msg:
/var/folders/0l/9t0yv2890_g4wgmy53n_mg7w0000gy/T/test-55cfcb.sh
clang-13: note: diagnostic msg: Crash backtrace is located in
clang-13: note: diagnostic msg:
/Users/aodwyer/Library/Logs/DiagnosticReports/clang-13_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang-13: note: diagnostic msg: (choose the .crash file that corresponds to
your crash)
clang-13: 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/20210327/400034d4/attachment.html>


More information about the llvm-bugs mailing list