[llvm-bugs] [Bug 47693] New: C++20 Designated Initializers - Multiple initializations of same struct member

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 30 08:22:38 PDT 2020


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

            Bug ID: 47693
           Summary: C++20 Designated Initializers - Multiple
                    initializations of same struct member
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cai at synopsys.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Hi,

I believe Clang shouldn't compile the code below with -std=c++20.

struct X
{
    int a;
};

int main()
{
    X x{.a = 0, .a = 1};
    return 0;
}

GCC fails to compile it with the error:
error: '.a' designator used multiple times in the same initializer list

   14 |     X x{.a = 0, .a = 1};


Clang trunk successfully compiles the example.

-- 
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/20200930/eb1b186a/attachment-0001.html>


More information about the llvm-bugs mailing list