https://bugs.llvm.org/show_bug.cgi?id=43232

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

==============================
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
case:

============================
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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to