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

            Bug ID: 106290
           Summary: A non-static data member of an anonymous union member
                    appears in the default-member-initializer of another
                    should be well-formed
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xmh970252187 at gmail dot com
  Target Milestone: ---

struct B{
    union{
      int a;
      int b = (a,10);
    };
};

For this case https://godbolt.org/z/5KnK8azEM, GCC renders an error, with a
diagnosis: 
"error: invalid use of non-static data member 'B::<unnamed union>::a'"

However, such use should be valid and does not violate any rule in the
standard. Clang accepts this example.
  • [Bug c++/106290] New: A non-sta... xmh970252187 at gmail dot com via Gcc-bugs

Reply via email to