hintonda marked an inline comment as done.
hintonda added inline comments.

================
Comment at: clang/test/SemaCXX/cxx2a-initializer-aggregates.cpp:30
+// out of order designators
+A a1 = {.y = 1, .x = 2}; // expected-warning {{designated initializers are a 
C99 feature}}
+
----------------
Rakete1111 wrote:
> hintonda wrote:
> > lebedev.ri wrote:
> > > hintonda wrote:
> > > > Rakete1111 wrote:
> > > > > Those warnings are misleading, since C++20 does have designated 
> > > > > initializers; they just don't support some stuff that C99 does. It 
> > > > > would be better  IMO if you could separate them. As in, the above 
> > > > > should give you: `out-of-order designated initializers are a C99 
> > > > > feature` or something like that.
> > > > I think that would be a good idea as well, but wanted to get advise 
> > > > first.
> > > > As in, the above should give you: out-of-order designated initializers 
> > > > are a C99 feature or something like that.
> > > 
> > > I suppose also the question is, whether to error-out, or support them as 
> > > an extension?
> > > 
> > Although most of them seem fine, the nested ones can be problematic.  
> > Please see https://reviews.llvm.org/D17407 for a proposal on how to fix 
> > them.
> > I suppose also the question is, whether to error-out, or support them as an 
> > extension?
> 
> Yes that's true. gcc doesn't support them at all in C++, and it seems like we 
> accept it as well, but only for C classes (constructors make clang crash).
> 
> But making it an error now breaks backwards compatibility. So I think the 
> best solution is to accept it for now, as an extension.
Btw, several cpp tests use nested designated initializers.  Here's a quick list 
I got by temporarily making it an error:

  CodeGenCXX/mangle-exprs.cpp
  SemaCXX/cxx2a-initializer-aggregates.cpp
  SemaCXX/decltype.cpp
  SemaTemplate/instantiate-init.cpp

I believe there are a several out of order ones as well, but those might have 
been unintentional.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59754



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to