[llvm-bugs] [Bug 49020] New: Allowing brace elision even with desgnated initializers

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 3 07:19:44 PST 2021


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

            Bug ID: 49020
           Summary: Allowing brace elision even with desgnated
                    initializers
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: barry.revzin at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

>From StackOverflow (https://stackoverflow.com/q/66000330/2069064):

struct A  {
    int a;
};

struct B {
    int b;
};

struct C {
    A a;
    B b;
};

C c{.a=0, .b={12}};

Clang accepts this program. But ".a=0" isn't a valid designated initializer,
you can't initialize an A with "=0". I think clang might be performing brace
elision here, which shouldn't apply to designated initializers.

-- 
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/20210203/772cf42c/attachment.html>


More information about the llvm-bugs mailing list