================
@@ -3244,6 +3244,17 @@ static bool canUseCtorHoming(const CXXRecordDecl *RD) {
       RD->hasConstexprNonCopyMoveConstructor())
     return false;
 
+  // Skip this optimization if this type is standard-layout and is a member of
+  // some standard-layout union in this translation unit. Per the C++ spec, "it
----------------
dwblaikie wrote:

I /believe/ that's not the case - I think Clang does incremental lowering 
(lowering functions to LLVM IR as they are parsed, rather than in a batch at 
the end). For insntance, try debugging clang as it compiles this program with 
debug info enabled:
```
struct t1 { };
void f1(t1) {
}
void f2() {
  return 1;
}
```
Break in canUseCtorHoming, and note that the breakpoint is recached before the 
diagnostic is hit for the mismatched return in f2.

Not sure what concerns @efriedma-quic has with this situation, but if he's got 
a moment to expand on it - should be considered.

https://github.com/llvm/llvm-project/pull/221615
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to