<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 - ICE on invalid: llvm::cast assert-fails in ParseLexedMethodDeclaration"
   href="https://bugs.llvm.org/show_bug.cgi?id=49735">49735</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ICE on invalid: llvm::cast assert-fails in ParseLexedMethodDeclaration
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>arthur.j.odwyer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> 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>
<span class="quote">>, std::__1::basic_string<char, std::__1::char_traits<char>,</span >
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>
<span class="quote">>, std::__1::basic_string<char, std::__1::char_traits<char>,</span >
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>
<span class="quote">>, std::__1::basic_string<char, std::__1::char_traits<char>,</span >
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 (<a href="mailto:git@github.com">git@github.com</a>: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: 

********************</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>