[llvm-bugs] [Bug 40030] New: Designated initialisers - diagnose invalid designator order in C++20
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Dec 14 12:43:40 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=40030
Bug ID: 40030
Summary: Designated initialisers - diagnose invalid designator
order in C++20
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: david.bolvansky 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 S
{
int number;
const char *s;
};
S f()
{
return S{.number = 0, .s = "hi}; // correct order
return S{.s = "hi", .number = 0}; // invalid (out of) order
}
This should not be allowed in C++20 (according to a C++2a standard) and GCC
does not compile it - Clang trunk allows it.
GCC:
error: designator order for field 'S::number' does not match declaration order
in 'S'
12 | return S{.s = "hi", .number = 0};
--
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/20181214/6e0e4e54/attachment.html>
More information about the llvm-bugs
mailing list