https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105256

--- Comment #20 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #16)
> Don't both of those tests have UB (sure, we shouldn't ICE), using
> uninitialized non-static data member?

NSDMIs are parsed at the end of the class, but I think I should have switched
the order of the initialization:

struct S {
  struct Prefs {
    struct P {
      int i = 42;
      int j = i;
    } p;
    void Load();
  };
};

void S::Prefs::Load() {
  *this = {};
};

but your test is good too.

Reply via email to