[llvm-bugs] [Bug 43232] New: -Wmissing-braces firing for aggregate structs with only 1 base and no members

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 5 21:29:50 PDT 2019


            Bug ID: 43232
           Summary: -Wmissing-braces firing for aggregate structs with
                    only 1 base and no members
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: wyverald at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

struct Base { int i, j; };
struct Derived : public Base {};
int test() { return Derived{3, 4}.i; }

The code above fires a -Wmissing-braces warning. This is rather annoying since
the suggested alternative `Derived{{3, 4}}` isn't much better.

This is related to the old bug https://bugs.llvm.org/show_bug.cgi?id=21629
which was resolved by r314838, which specifically whitelisted the following

struct Inner { int i, j; };
struct Outer { Inner inner; };
int test() { return Outer{3, 4}.i; }

r314838 specifically mentions in a FIXME: "Should aggregate initialization of a
struct with a single base class and no members also suppress the warning?" I
think the answer should be yes.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190906/075e9d91/attachment-0001.html>

More information about the llvm-bugs mailing list