On Tue, Dec 22, 2020 at 03:57:56PM +0800, jim x via Gcc-patches wrote: > struct A{ > A(){} > }; > union C{ > A a; > int b = 0; > }; > int main(){ > C c; > } > > GCC reports the default constructor for union `C` is defined as > deleted. However, the relevant rule in the current c++ standard says > that: > > A defaulted default constructor for class X is defined as deleted if: > >> X is a union that has a variant member with a non-trivial default > >> constructor and no variant member of X has a default member initializer, > >> X is a non-union class that has a variant member M with a non-trivial > >> default constructor and no variant member of the anonymous union > >> containing M has a default member initializer
That would mean GCC (but neither clang++ nor ICC too) doesn't implement CWG2084 properly. Why are you mailing gcc-patches though when you don't have a patch? TThis should be filed into https://gcc.gnu.org/bugzilla/ Jakub