Issue 156352
Summary Crash clang++
Labels clang
Assignees
Reporter VitorRamos
    ```c++
Stack dump:
0.      Program arguments: clang++ -std=c++20 -fstandalone-debug -fvisibility=hidden -g -O2 -c main.cpp
1.      main.cpp:58:27: current parser token ';'
2.      main.cpp:58:23: instantiating class definition 'b<n>'
 #0 0x00005599b0f77438 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/llvm19/bin/clang-19+0x695d438)
 #1 0x00005599b0f748ce llvm::sys::RunSignalHandlers() (/opt/llvm19/bin/clang-19+0x695a8ce)
 #2 0x00005599b0ed1547 CrashRecoverySignalHandler(int) (.llvm.11302594287015708483) CrashRecoveryContext.cpp:0:0
 #3 0x00007fa3840ed520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00005599b124ae40 clang::CodeGen::CGDebugInfo::CollectRecordFields(clang::RecordDecl const*, llvm::DIFile*, llvm::SmallVectorImpl<llvm::Metadata*>&, llvm::DICompositeType*) (/opt/llvm19/bin/clang-19+0x6c30e40)
 #5 0x00005599b124f8e9 clang::CodeGen::CGDebugInfo::CreateTypeDefinition(clang::RecordType const*) (/opt/llvm19/bin/clang-19+0x6c358e9)
 #6 0x00005599b124f53e clang::CodeGen::CGDebugInfo::completeClass(clang::RecordDecl const*) (/opt/llvm19/bin/clang-19+0x6c3553e)
 #7 0x00005599b183b0bf (anonymous namespace)::CodeGeneratorImpl::HandleTagDeclRequiredDefinition(clang::TagDecl const*) (.llvm.14912255421585949504) ModuleBuilder.cpp:0:0
 #8 0x00005599b4a0ed78 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) (/opt/llvm19/bin/clang-19+0xa3f4d78)
 #9 0x00005599b4165c2e ComputeDefaultedSpecialMemberExceptionSpec(clang::Sema&, clang::SourceLocation, clang::CXXMethodDecl*, clang::CXXSpecialMemberKind, clang::Sema::InheritedConstructorInfo*) SemaDeclCXX.cpp:0:0
#10 0x00005599b41276c9 clang::Sema::EvaluateImplicitExceptionSpec(clang::SourceLocation, clang::FunctionDecl*) (/opt/llvm19/bin/clang-19+0x9b0d6c9)
#11 0x00005599b421f5df clang::Sema::ResolveExceptionSpec(clang::SourceLocation, clang::FunctionProtoType const*) (/opt/llvm19/bin/clang-19+0x9c055df)
#12 0x00005599b4221b26 clang::Sema::CheckExceptionSpecSubset(clang::PartialDiagnostic const&, clang::PartialDiagnostic const&, clang::PartialDiagnostic const&, clang::PartialDiagnostic const&, clang::FunctionProtoType const*, bool, clang::SourceLocation, clang::FunctionProtoType const*, bool, clang::SourceLocation) (/opt/llvm19/bin/clang-19+0x9c07b26)
#13 0x00005599b4222abd clang::Sema::CheckOverridingFunctionExceptionSpec(clang::CXXMethodDecl const*, clang::CXXMethodDecl const*) (/opt/llvm19/bin/clang-19+0x9c08abd)
#14 0x00005599b4130180 clang::Sema::CheckDelayedMemberExceptionSpecs() (/opt/llvm19/bin/clang-19+0x9b16180)
#15 0x00005599b48fd335 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) (/opt/llvm19/bin/clang-19+0xa2e3335)
#16 0x00005599b48ff808 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) (/opt/llvm19/bin/clang-19+0xa2e5808)
#17 0x00005599b4771d58 clang::Sema::ActOnExplicitInstantiation(clang::Scope*, clang::SourceLocation, clang::SourceLocation, unsigned int, clang::SourceLocation, clang::CXXScopeSpec const&, clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation, clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation, clang::ParsedAttributesView const&) (/opt/llvm19/bin/clang-19+0xa157d58)
#18 0x00005599b3ca8892 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/opt/llvm19/bin/clang-19+0x968e892)
#19 0x00005599b3c6e838 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/llvm19/bin/clang-19+0x9654838)
#20 0x00005599b3cbc369 clang::Parser::ParseDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/llvm19/bin/clang-19+0x96a2369)
#21 0x00005599b3cbac76 clang::Parser::ParseExplicitInstantiation(clang::DeclaratorContext, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/llvm19/bin/clang-19+0x96a0c76)
#22 0x00005599b3c16629 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/llvm19/bin/clang-19+0x95fc629)
#23 0x00005599b3c149a1 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/llvm19/bin/clang-19+0x95fa9a1)
#24 0x00005599b3c0fc9e clang::ParseAST(clang::Sema&, bool, bool) (/opt/llvm19/bin/clang-19+0x95f5c9e)
#25 0x00005599b1d0ec34 clang::FrontendAction::Execute() (/opt/llvm19/bin/clang-19+0x76f4c34)
#26 0x00005599b1c47d60 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/llvm19/bin/clang-19+0x762dd60)
#27 0x00005599b1e11e7a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/llvm19/bin/clang-19+0x77f7e7a)
#28 0x00005599ae88f1cf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/llvm19/bin/clang-19+0x42751cf)
#29 0x00005599ae88b1ff ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#30 0x00005599b1a99a19 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_0>(long) Job.cpp:0:0
#31 0x00005599b0ed1108 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/llvm19/bin/clang-19+0x68b7108)
#32 0x00005599b1a99664 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/opt/llvm19/bin/clang-19+0x747f664)
#33 0x00005599b1a56f0b clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/llvm19/bin/clang-19+0x743cf0b)
#34 0x00005599b1a76eeb clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/llvm19/bin/clang-19+0x745ceeb)
#35 0x00005599ae88a62e clang_main(int, char**, llvm::ToolContext const&) (/opt/llvm19/bin/clang-19+0x427062e)
#36 0x00005599ae89d1ba main (/opt/llvm19/bin/clang-19+0x42831ba)
#37 0x00007fa3840d4d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#38 0x00007fa3840d4e40 call_init ./csu/../csu/libc-start.c:128:20
#39 0x00007fa3840d4e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#40 0x00005599ae87cea5 _start (/opt/llvm19/bin/clang-19+0x4262ea5)
```

After creduce
```c++
#include <utility>
class a;
template <class> class b;
class c {
public:
  using d = a;
};
template <class> class f {
 using g = int;

public:
  static constexpr bool h = std::is_same<g, c>::value;
};
template <class> class j;
template <class e> class l {
 using k = e::k;
  k m();
};
class n;
class F {
  using i = j<n>;
  i q();
};
template <class o> class j : std::conditional_t<f<o>::h, typename o::g, o> {
public:
  using e = n;
  using p = e;
  using d = b<e>;
  d *r;
};
class s;
class G {
public:
  using k = s;
};
class t {
 ~t();
  l<G> y;
};
t::~t() = default;
class n {
public:
  using k = F;
  using g = c;
};
class I {
  l<n> u;
};
class a {
public:
 virtual ~a();
};
template <class e> class b : e::g::d {
  using v = j<e>::p;
  int w;
};
class s : I {};
extern template class b<n>;
```

`clang++ -std=c++20 -fstandalone-debug -fvisibility=hidden -g -O2 -c main.cpp`
clang version 20.1
https://godbolt.org/z/e1xPW9veb
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to