[PATCH] D59754: [Sema] Add c++2a designated initializer warnings

Richard Smith - zygoloid via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 8 18:13:23 PDT 2019


rsmith added a comment.

In D59754#1656217 <https://reviews.llvm.org/D59754#1656217>, @leonardchan wrote:

> Hi! We've noticed that for our arm bots, we're getting some flaky builds that sometimes fail with `error: array designators are a C99 extension [-Werror,-Wc99-designator]` and sometimes don't fail. 2 questions:
>
> 1. I can't see it off the patch immediately, but do you know why for arm specifically we can only get this warning sometimes?


That is strange; can you provide me with buildbot links for a pass and a failure?

> 2. I noticed that for the `test/SemaCXX/c99.cpp` test, this warning is also diagnosed for the `-std=c++17` case. Are C-style designated initializers only invalid in c++20, or are they also invalid in 17?

C-style designated initializers are invalid in all C++ standards before C++20, and some of the features are still invalid in C++20. We allow those features as an extension, but as of this change we produce a warning by default when that extension is used. We really should have been doing that for years, but it matters a lot more now, because people are going to look at Clang's diagnostics to understand which parts of C designator syntax are valid in C++ and which parts are not.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59754





More information about the llvm-commits mailing list