public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107434] New: Wrong -Wmissing-field-initializers for C++ designated initializers
@ 2022-10-27 12:08 chfast at gmail dot com
  2022-10-27 14:51 ` [Bug c++/107434] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: chfast at gmail dot com @ 2022-10-27 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107434
           Summary: Wrong -Wmissing-field-initializers for C++ designated
                    initializers
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chfast at gmail dot com
  Target Milestone: ---

If a struct S has a field c of type C having user constructor the
"missing-field-initializers" is reported for this field even though designated
initializers are used.

struct C
{
    int x = 0;
};

struct S
{
    C c;
    bool flag = false;

};

S test()
{
    return {.flag = true};
}

<source>: In function 'S test()':
<source>:15:25: warning: missing initializer for member 'S::c'
[-Wmissing-field-initializers]
   15 |     return {.flag = true};
      |                         ^

https://godbolt.org/z/sxc8PP7Pq

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

* [Bug c++/107434] Wrong -Wmissing-field-initializers for C++ designated initializers
  2022-10-27 12:08 [Bug c++/107434] New: Wrong -Wmissing-field-initializers for C++ designated initializers chfast at gmail dot com
@ 2022-10-27 14:51 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-27 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 96868.
C has an implicit constructor.

*** This bug has been marked as a duplicate of bug 96868 ***

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

end of thread, other threads:[~2022-10-27 14:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 12:08 [Bug c++/107434] New: Wrong -Wmissing-field-initializers for C++ designated initializers chfast at gmail dot com
2022-10-27 14:51 ` [Bug c++/107434] " pinskia 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).