[llvm-bugs] [Bug 40030] Designated initialisers - diagnose invalid designator order in C++20

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 6 06:31:31 PDT 2021


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

Aaron Ballman <aaron at aaronballman.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME
                 CC|                            |aaron at aaronballman.com

--- Comment #1 from Aaron Ballman <aaron at aaronballman.com> ---
This diagnostic appears to already be implemented:
https://godbolt.org/z/EPnG1EqKd

<source>:10:26: warning: ISO C++ requires field designators to be specified in
declaration order; field 's' will be initialized after field 'number'
[-Wreorder-init-list]
    return S{.s = "hi",  .number = 0}; // invalid (out of) order
                         ^~~~~~~~~~~
<source>:10:19: note: previous initialization for field 's' is here
    return S{.s = "hi",  .number = 0}; // invalid (out of) order
                  ^~~~
1 warning generated.

Closing as WORKSFORME, but if I'm missing something, please reopen with more
details. Thanks!

-- 
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/20211006/0ff341be/attachment.html>


More information about the llvm-bugs mailing list