[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
Mon Mar 11 13:19:52 PDT 2019
thakis marked 2 inline comments as done.
thakis added inline comments.
Comment at: clang/lib/Parse/ParseDecl.cpp:3892-3893
+/// Note that a struct declaration refers to a declaration in a struct,
+/// not to the declaration of a struct.
> Seems to be unrelated to this patch? Feel free to commit separately.
It's somewhat related in that ParseStructDeclaration() is called a few lines below where I'm adding the comment talking about ParseStructUnionBody()
Comment at: clang/test/Parser/objc-static-assert.mm:1
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
> Can you try explicitly specifying C++98 as the underlying language standard mode? I feel like `_Static_assert()` will continue to work there (because we made it a language extension in all modes) but `static_assert()` may fail (because that's gated on C++11 support). If that turns out to be the case, then I think `objc_static_assert` should be more complex than expanding to `true`, or we should talk about supporting `static_assert()` in all C++ language modes like we do for `_Static_assert()`.
Correct, with -std=c++98 static_assert isn't available but _Static_assert still is. If you want, I can add a test for this, but this is covered by regular c++ tests already.
I think the has_feature() should stay as-is though: Else you have no way to know if _Static_assert works in obj-c mode, and you can check if static_assert works by checkout has_feature && __cplusplus >= 201103L if you still care about c++98.
(And adding one feature each for static_assert and _Static_assert seems like overkill.)
CHANGES SINCE LAST ACTION
More information about the cfe-commits