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

            Bug ID: 90432
           Summary: Internal compiler error with no_unique_address empty
                    type with constructor call followed by value
                    initialized to non-zero
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david at doublewise dot net
  Target Milestone: ---

The following code causes an internal compiler error:


struct empty {};

struct has_empty {
        [[no_unique_address]] empty brace_or_equal_initialized{};
};

struct has_value {
        int non_zero = 1;
};


struct pair : has_empty, has_value {};

pair a;
//pair b = pair();





<source>:14:7: internal compiler error: in output_constructor_regular_field, at
varasm.c:5207

   14 | pair a;

      |       ^




See it live: https://godbolt.org/z/tvdsmg


The error occurs if you comment out a and uncomment b, as well.
`brace_or_equal_initialized` can also be initialized by a regular constructor
call, the important part is just that the constructor is explicitly called.

Reply via email to