https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115557
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|initializing reference |Invalid NSDMI accepted for |property inside template |templates classes for a |context - error is not |aggregate that binds to a |recognized |temp Known to fail| |4.7.1 Status|UNCONFIRMED |NEW Blocks| |58616 Ever confirmed|0 |1 Last reconfirmed| |2024-06-21 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. A does not need to have a ctor either. This is also invalid: ``` struct A{ int t; }; template<typename T> struct B{ B(A &a) : a(a){} A &a{ 4 }; // this is wrong }; int main(){ A a{5}; B<double> b(a); } ``` GCC has incorrectly accepted this since NSDMI support was added in 4.7. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58616 [Bug 58616] [meta-bug] nsdmi