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

            Bug ID: 97470
           Summary: ICE when using aggregate initialization of a
                    particular layout with non trivial type
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gufideg at gmail dot com
  Target Milestone: ---

Here's a minimal case:

    struct nontrivial {
        nontrivial();
        nontrivial(nontrivial const&);
        long a;
    };

    struct foo {
        nontrivial nt;
        char b;
    };

    struct bar : foo {};

    foo get_foo();

    bar a{
        get_foo()
    };


Live ICE on compiler explorer: https://godbolt.org/z/WqnWY9

Changing `a` to something with a smaller size won't trigger the ICE.
Changing `b` to something with the same size of `a` won't trigger the ICE.
Changing `bar a{get_foo()}` to `bar a{foo{}}` won't trigger the ICE.
Swapping the members of foo will also make the ICE go away.

Reply via email to