[PATCH] D97872: [clang] Don't assert in EmitAggregateCopy on trivial_abi types
Arthur Eubanks via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 3 09:59:47 PST 2021
aeubanks created this revision.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Fixes PR42961.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97872
Files:
clang/lib/CodeGen/CGExprAgg.cpp
clang/test/CodeGenCXX/trivial_abi.cpp
Index: clang/test/CodeGenCXX/trivial_abi.cpp
===================================================================
--- clang/test/CodeGenCXX/trivial_abi.cpp
+++ clang/test/CodeGenCXX/trivial_abi.cpp
@@ -262,3 +262,6 @@
void testExceptionLarge() {
calleeExceptionLarge(Large(), Large());
}
+
+// PR42961
+Small (*fp)() = []() -> Small {};
Index: clang/lib/CodeGen/CGExprAgg.cpp
===================================================================
--- clang/lib/CodeGen/CGExprAgg.cpp
+++ clang/lib/CodeGen/CGExprAgg.cpp
@@ -2056,7 +2056,7 @@
Record->hasTrivialCopyAssignment() ||
Record->hasTrivialMoveConstructor() ||
Record->hasTrivialMoveAssignment() ||
- Record->isUnion()) &&
+ Record->hasAttr<TrivialABIAttr>() || Record->isUnion()) &&
"Trying to aggregate-copy a type without a trivial copy/move "
"constructor or assignment operator");
// Ignore empty classes in C++.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97872.327840.patch
Type: text/x-patch
Size: 982 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210303/efbe7e1e/attachment.bin>
More information about the cfe-commits
mailing list