[clang] [clang] Allow class with anonymous union member to be const-default-constructible even if a union member has a default member initializer (#95854) (PR #96301)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 23:51:29 PDT 2024


================
@@ -217,6 +217,11 @@ Bug Fixes to C++ Support
 - Clang now preserves the unexpanded flag in a lambda transform used for pack expansion. (#GH56852), (#GH85667),
   (#GH99877).
 - Fixed a bug when diagnosing ambiguous explicit specializations of constrained member functions.
+- Clang incorrectly considers a class with an anonymous union member to not be
+  const-default-constructible even if a union member has a default member initializer.
+  This is valid as per ``8.3`` in `Draft C++ Standard <https://eel.is/c++draft/dcl.init#general-8.3>`_.
+  The ``allowConstDefaultInit`` member function in ``CXXRecordDecl`` needs
+  special-case unions to handle the rule. (#GH95854).
----------------
Sirraide wrote:

```suggestion
  (#GH95854).
```
I don’t think any of that needs to be here.

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


More information about the cfe-commits mailing list