public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "matt at godbolt dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96868] New: C++20 designated initializer erroneous warnings Date: Mon, 31 Aug 2020 12:57:39 +0000 [thread overview] Message-ID: <bug-96868-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96868 Bug ID: 96868 Summary: C++20 designated initializer erroneous warnings Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matt at godbolt dot org Target Milestone: --- The following code, with -Wall -Wextra, GCC 10.x or trunk, -std=c++20: ``` struct MyObj { MyObj(); }; struct Test { int a{}; MyObj obj; }; Test t() { Test t{.a = 1}; return t; } ``` Creates a warning: ``` <source>: In function 'Test t()': <source>:11:18: warning: missing initializer for member 'Test::obj' [-Wmissing-field-initializers] 11 | Test t{.a = 1}; | ^ ``` The "obj" is not missing initialization: the generated code correctly calls MyObj::MyObj(). clang issues no diagnostic on the same code (even with -Weverything). May be a duplicate of bug #82283 or bug #84685, but those have far more complex-looking initialiser lists. CE link: https://godbolt.org/z/b75P6r
next reply other threads:[~2020-08-31 12:57 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-31 12:57 matt at godbolt dot org [this message] 2020-09-01 1:11 ` [Bug c++/96868] " mpolacek at gcc dot gnu.org 2020-09-01 2:47 ` matt at godbolt dot org 2021-11-22 9:35 ` redi at gcc dot gnu.org 2022-02-10 21:15 ` dzhioev at gmail dot com 2022-10-27 14:51 ` pinskia at gcc dot gnu.org 2022-10-29 12:27 ` chfast at gmail dot com 2023-06-08 18:00 ` mpolacek at gcc dot gnu.org 2023-06-09 14:23 ` cvs-commit at gcc dot gnu.org 2023-08-21 17:44 ` roland at gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-96868-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).