[PATCH] D59223: Objective-C++11: Support static_assert() in @interface/@implementation ivar lists and method declarations

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 16:00:49 PDT 2019


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


================
Comment at: clang/include/clang/Basic/Features.def:121
 FEATURE(objc_class_property, LangOpts.ObjC)
+FEATURE(objc_c_static_assert, true)
+FEATURE(objc_cxx_static_assert, LangOpts.CPlusPlus11)
----------------
erik.pilkington wrote:
> We should only claim `_Static_assert` is a feature in languages where its actually a formal language feature (C11), you can also use EXTENSION to indicate what languages we accept it in (see the comment in the file header).
Sorry, I don't follow. clang accepts `_Static_assert` in C89. You're saying you want `__has_feature(objc_c_static_assert)` to be false there? I'm guessing because -pedantic warns on it?

But if we do this, there's no way to differentiate clang-in-std=c89 mode with this patch from clang-without-this-patch, is there? Is that what you want? i.e. replace `true` with `LangOpts.C11`?

(For now, I updated the test to check the __has_feature() is true in c89 too.)

(That seems like another argument to restore the single feature to me since this working in objc is orthogonal on if the language version supports static asserts.)


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

https://reviews.llvm.org/D59223





More information about the cfe-commits mailing list