================
@@ -8900,7 +8900,8 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,
<< Call->getCallee()->getSourceRange());
else if (const auto *RT = PointeeTy->getAs<RecordType>()) {
- bool IsTriviallyCopyableCXXRecord =
+ bool MayBeTriviallyCopyableCXXRecord =
+ RT->isIncompleteType() ||
----------------
AaronBallman wrote:
So you're basically talking about this case:
```
struct S;
void foo(S *s1, S *s2) {
memcpy(s1, s2, 10);
}
struct S {
S(const S&);
S& operator=(const S &);
};
```
I'm not certain that's worth splitting off as its own diagnostic as `memcpy`,
`memset`, etc all need you to pass in a size parameter and... anything the user
puts there in case of an incomplete type is pretty suspect. Based on that, I
think we may *want* the diagnostic for incomplete types, but that the
diagnostic only makes sense in C++ regardless of whether the type is complete
or not.
However, GCC silences the diagnostic for incomplete types:
https://godbolt.org/z/bsPnrKf19 so I may be missing some use case where this
construct is safer than I'm thinking.
https://github.com/llvm/llvm-project/pull/114095
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits