public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101767] New: Aggregate initialization fails for struct that has both unnamed struct and union fields
@ 2021-08-03 20:18 xtkoba at gmail dot com
  2021-08-03 20:40 ` [Bug c++/101767] [11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: xtkoba at gmail dot com @ 2021-08-03 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101767
           Summary: Aggregate initialization fails for struct that has
                    both unnamed struct and union fields
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xtkoba at gmail dot com
  Target Milestone: ---

Created attachment 51254
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51254&action=edit
Repro

$ cat unnamed_fields.cc

typedef struct {
  struct {
    int x;
  };
  union {
    int y;
    float z;
  };
} S;

void foo(void)
{
  [[maybe_unused]] S a = {
    .x = 1,
    .y = 0
  };
}

$ g++-11.2.0 unnamed_fields.cc -c
unnamed_fields.cc: In function 'void foo()':
unnamed_fields.cc:17:3: error: 'S::<unnamed struct>' has no non-static data
member named 'y'
   17 |   };
      |   ^

$ g++-11.2.0 -v
Using built-in specs.
COLLECT_GCC=g++-11.2.0
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/11.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-11.2.0/work/gcc-11.2.0/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/11.2.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.2.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.2.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/11.2.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/g++-v11
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/11.2.0/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 11.2.0 p1'
--disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-multilib
--with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all
--enable-libgomp --disable-libssp --disable-libada --disable-systemtap
--disable-valgrind-annotations --disable-vtable-verify --disable-libvtv
--without-zstd --enable-lto --without-isl --enable-default-pie
--enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (Gentoo 11.2.0 p1)

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-05-12 22:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 20:18 [Bug c++/101767] New: Aggregate initialization fails for struct that has both unnamed struct and union fields xtkoba at gmail dot com
2021-08-03 20:40 ` [Bug c++/101767] [11/12 Regression] " pinskia at gcc dot gnu.org
2021-08-03 20:50 ` [Bug c++/101767] [10/11/12 " pinskia at gcc dot gnu.org
2021-08-04  5:59 ` rguenth at gcc dot gnu.org
2021-11-16 21:56 ` pinskia at gcc dot gnu.org
2022-01-20 14:52 ` ppalka at gcc dot gnu.org
2022-02-09  8:23 ` antmak.pub at gmail dot com
2022-03-18 18:12 ` jason at gcc dot gnu.org
2022-03-21 20:47 ` cvs-commit at gcc dot gnu.org
2022-03-21 20:58 ` [Bug c++/101767] [11 " jason at gcc dot gnu.org
2022-03-22  5:18 ` cvs-commit at gcc dot gnu.org
2022-03-26 23:29 ` jason at gcc dot gnu.org
2022-05-12 21:14 ` cvs-commit at gcc dot gnu.org
2022-05-12 22:24 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).