[clang] Initial implementation of P2719 (PR #113510)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 25 10:00:22 PDT 2024


================
@@ -17389,6 +17389,19 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
     Previous.clear();
   }
 
+  // I think DC check should be DC->isStdNamespace()?
+  // Also these guards are questionable - it's possible to get incorrect
+  // codegen when the declared type does not match the expected type.
+  // e.g. something like
+  //    namespace std { struct align_val_t { explicit align_val_t(size_t); } };
+  // can result in an operator new/delete decl picking up this specified
+  // align_val_t struct, but the align_val_t constructed implicitly has the
+  // mismatching internal definition.
+  //
+  // The correct course of action is probably to perform this logic at the point
----------------
erichkeane wrote:

This is perhaps not a bad idea, though it could go in a different patch.  Typically we take the fact that defining that in user code is UB, so we can count on its structure.

https://github.com/llvm/llvm-project/pull/113510


More information about the cfe-commits mailing list