alexfh wrote:

@cor3ntin this commit causes an assertion failure: 
https://gcc.godbolt.org/z/7hW4ssrfq
```
$ cat test.cc
struct E {
  virtual void f();
};
struct G {
  E e;
};
template <typename>
struct Test {
  virtual void f() {
    E e;
    G g(e);
  }
};
auto *t = new Test<int>;

$ ./clang-bad -c -o /dev/null -std=c++20 test.cc
assertion failed at clang/lib/CodeGen/CGExprAgg.cpp:2303 in void 
clang::CodeGen::CodeGenFunction::EmitAggregateCopy(LValue, LValue, QualType, 
AggValueSlot::Overlap_t, bool): (Record->hasTrivialCopyConstructor() || 
Record->hasTrivialCopyAssignment() || Record->hasTrivialMoveConstructor() || 
Record->hasTrivialMoveAssignment() || Record->hasAttr<TrivialABIAttr>() || 
Record->isUnion()) && "Trying to aggregate-copy a type without a trivial 
copy/move " "constructor or assignment operator"
    @     0x55e4e4e3cfe4  __assert_fail
    @     0x55e4df16f247  clang::CodeGen::CodeGenFunction::EmitAggregateCopy()
    @     0x55e4df175f3e  (anonymous namespace)::AggExprEmitter::EmitCopy()
    @     0x55e4df16e4b6  (anonymous 
namespace)::AggExprEmitter::EmitFinalDestCopy()
    @     0x55e4df1762dc  (anonymous 
namespace)::AggExprEmitter::EmitAggLoadOfLValue()
    @     0x55e4df16de02  clang::CodeGen::CodeGenFunction::EmitAggExpr()
    @     0x55e4df00e593  
clang::CodeGen::CodeGenFunction::EmitInitializationToLValue()
    @     0x55e4df177fea  (anonymous 
namespace)::AggExprEmitter::VisitCXXParenListOrInitListExpr()
    @     0x55e4df16de02  clang::CodeGen::CodeGenFunction::EmitAggExpr()
    @     0x55e4df08640c  clang::CodeGen::CodeGenFunction::EmitExprAsInit()
    @     0x55e4df08314b  clang::CodeGen::CodeGenFunction::EmitAutoVarInit()
    @     0x55e4df07bfe7  clang::CodeGen::CodeGenFunction::EmitVarDecl()
    @     0x55e4df07ba62  clang::CodeGen::CodeGenFunction::EmitDecl()
    @     0x55e4df115940  clang::CodeGen::CodeGenFunction::EmitDeclStmt()
    @     0x55e4df10a5de  clang::CodeGen::CodeGenFunction::EmitSimpleStmt()
    @     0x55e4df10983f  clang::CodeGen::CodeGenFunction::EmitStmt()
    @     0x55e4df116d61  
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope()
    @     0x55e4df2725f4  clang::CodeGen::CodeGenFunction::GenerateCode()
    @     0x55e4df29cd88  
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition()
    @     0x55e4df293f22  clang::CodeGen::CodeGenModule::EmitGlobalDefinition()
    @     0x55e4df284de2  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e4df284dfe  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e4df284dfe  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e4df281a2d  clang::CodeGen::CodeGenModule::Release()
    @     0x55e4df3c750e  (anonymous 
namespace)::CodeGeneratorImpl::HandleTranslationUnit()
    @     0x55e4def2ef1a  clang::BackendConsumer::HandleTranslationUnit()
    @     0x55e4dfe45d68  clang::ParseAST()
    @     0x55e4dfb7e7aa  clang::FrontendAction::Execute()
    @     0x55e4dfaf319d  clang::CompilerInstance::ExecuteAction()
    @     0x55e4def2e4ab  clang::ExecuteCompilerInvocation()
    @     0x55e4def21f17  cc1_main()
```

Actually, I can reproduce the assertion failure in Clang before this commit 
using a different example, but I haven't yet reduced it. It might be a distinct 
problem though despite the same assertion failure.

https://github.com/llvm/llvm-project/pull/138518
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to