From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 629B23861878; Mon, 31 Aug 2020 12:57:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 629B23861878 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598878659; bh=bEDFMc4RCPgillwNYamxW3l8ePpNGPa+32iVagUZjBk=; h=From:To:Subject:Date:From; b=ibL6ns6xgwbteoxhvRJl6GT6zs/FgyQxpfvvVEFizu653VW+c/SYw5/7WiIvEFRAK 6vnxyUNbLoiFi4ztVqdTpo3ZGZCpGO4OunY7ucGbj6opjQaNZ9bDgOQGj0vCaCihd8 rCUXCfXuMC65UyCzNp0ze1O1bx1xSj3ZMRkFAlxY= From: "matt at godbolt dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matt at godbolt dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2020 12:57:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96868 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=3Dc++20: ``` struct MyObj { MyObj(); }; struct Test { int a{}; MyObj obj; }; Test t() { Test t{.a =3D 1}; return t; } ``` Creates a warning: ``` : In function 'Test t()': :11:18: warning: missing initializer for member 'Test::obj' [-Wmissing-field-initializers] 11 | Test t{.a =3D 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=