[PATCH] D154675: [Clang] Fix crash when emitting diagnostic for out of order designated initializers in C++

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 9 15:18:03 PDT 2023


shafik marked an inline comment as done.
shafik added a comment.

Found a new issue https://github.com/llvm/llvm-project/issues/63759 but this feels different enough that I will deal with it separately.



================
Comment at: clang/test/SemaCXX/cxx2a-initializer-aggregates.cpp:182
+namespace GH63605 {
+struct {
+  unsigned : 2;
----------------
shafik wrote:
> cor3ntin wrote:
> > Should we add bases?
> Good catch b/c of course bases would cause problems 🤣
Problems due to bases now fixed as well.


================
Comment at: clang/test/SemaCXX/cxx2a-initializer-aggregates.cpp:195
+    .c = 1, // reorder-error {{field 'd' will be initialized after field 'c'}} // reorder-note {{previous initialization for field 'c' is here}}
+    .b = 1, // reorder-error {{field 'c' will be initialized after field 'b'}} // reorder-note {{previous initialization for field 'e' is here}}
+    .a = 1, // reorder-error {{field 'e' will be initialized after field 'a'}}
----------------
shafik wrote:
> Note the `e` in the diagnostic in this line and the next line should be `b`. I have not managed to figure out how to fix this yet but this feels relatively minor compared to the crash.
This is now fixed


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154675/new/

https://reviews.llvm.org/D154675



More information about the cfe-commits mailing list