Skip to content

Commit 2f51f92

Browse files
committed
Don't implement ByteRepr for non-trivially copyable types
1 parent a4f7a0a commit 2f51f92

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎cpp2rust/converter/converter_lib.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ bool TypeImplementsByteRepr(clang::QualType qt) {
286286
if (rd->isUnion()) {
287287
return true;
288288
}
289+
if (!qt.isTriviallyCopyableType(rd->getASTContext())) {
290+
return false;
291+
}
289292
for (const auto *field : rd->fields()) {
290293
if (!TypeImplementsByteRepr(field->getType())) {
291294
return false;

0 commit comments

Comments
 (0)