[clang] [clang-tools-extra] Reapply "[Clang][Sema] Diagnose class member access expressions naming non-existent members of the current instantiation prior to instantiation in the absence of dependent base classes (#84050)" (PR #90152)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 8 07:15:15 PDT 2024


bgra8 wrote:

@sdkrystian we've bisected a clang crash to this revision.

The code on which it crashes is (`repro.cc`):
```
template <typename> struct a {
  template <typename b> auto c(b d) -> decltype(operator=(d));
  void operator()();
};
a<void> e;
void f() { e(); }
```

Compilation command:
```
$ clang -std=gnu++20 -c repro.cc -o /tmp/out
repro.cc:6:12: error: cannot compile this l-value expression yet
    6 | void f() { e(); }
      |            ^
Stack dump:
0.      Program arguments: clang -std=gnu++20 -c repro.cc -o /tmp/out
1.      <eof> parser at end of file
2.      repro.cc:6:6: LLVM IR generation of declaration 'f'
3.      repro.cc:6:6: Generating code for declaration 'f'
 #0 0x000055ca8e2a92f8 llvm::sys::RunSignalHandlers() (clang+0x80a92f8)
 #1 0x000055ca8e270d16 CrashRecoverySignalHandler(int) (clang+0x8070d16)
 #2 0x00007fa7bc971e80 __restore_rt (/usr/lib64/libpthread.so.0+0x14e80)
 #3 0x000055ca893cb1c7 arrangeFreeFunctionLikeCall(clang::CodeGen::CodeGenTypes&, clang::CodeGen::CodeGenModule&, clang::CodeGen::CallArgList const&, clang::FunctionType const*, unsigned int, bool) (clang+0x31cb1c7)
 #4 0x000055ca89417be8 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) (clang+0x3217be8)
 #5 0x000055ca89416bed clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (clang+0x3216bed)
 #6 0x000055ca8942b1b3 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) (clang+0x322b1b3)
 #7 0x000055ca8941bd50 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (clang+0x321bd50)
 #8 0x000055ca893f83d9 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (clang+0x31f83d9)
 #9 0x000055ca894a13a1 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (clang+0x32a13a1)
#10 0x000055ca894af0d1 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (clang+0x32af0d1)
#11 0x000055ca8970c66b clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (clang+0x350c66b)
#12 0x000055ca8972e3b7 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (clang+0x352e3b7)
#13 0x000055ca897275d5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (clang+0x35275d5)
#14 0x000055ca8972b3ba clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (clang+0x352b3ba)
#15 0x000055ca89726590 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (clang+0x3526590)
#16 0x000055ca89833edc (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (clang+0x3633edc)
#17 0x000055ca893bf6ec clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (clang+0x31bf6ec)
#18 0x000055ca8a1f4a19 clang::ParseAST(clang::Sema&, bool, bool) (clang+0x3ff4a19)
#19 0x000055ca89f6bd3a clang::FrontendAction::Execute() (clang+0x3d6bd3a)
#20 0x000055ca89ee56e4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (clang+0x3ce56e4)
#21 0x000055ca8909b6cf clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (clang+0x2e9b6cf)
#22 0x000055ca89090bec cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (clang+0x2e90bec)
#23 0x000055ca8908dc26 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) (clang+0x2e8dc26)
#24 0x000055ca8a06b99e void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__u::optional<llvm::StringRef>>, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>>*, bool*) const::$_0>(long) (clang+0x3e6b99e)
#25 0x000055ca8e270aef llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (clang+0x8070aef)
#26 0x000055ca8a06b17a clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__u::optional<llvm::StringRef>>, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>>*, bool*) const (clang+0x3e6b17a)
#27 0x000055ca8a02d77d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (clang+0x3e2d77d)
#28 0x000055ca8a02da2f clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__u::pair<int, clang::driver::Command const*>>&, bool) const (clang+0x3e2da2f)
#29 0x000055ca8a04aed0 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__u::pair<int, clang::driver::Command const*>>&) (clang+0x3e4aed0)
#30 0x000055ca8908d224 clang_main(int, char**, llvm::ToolContext const&) (clang+0x2e8d224)
#31 0x000055ca8908b6f4 main (clang+0x2e8b6f4)
#32 0x00007fa7bc8023d4 __libc_start_main (/usr/lib64/libc.so.6+0x613d4)
#33 0x000055ca8908b62a _start (clang+0x2e8b62a)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
```





https://github.com/llvm/llvm-project/pull/90152


More information about the cfe-commits mailing list