[PATCH] D17444: PR26672: [MSVC] Clang does not recognize "static_assert" keyword in C mode
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 13 14:06:18 PST 2019
rnk added a subscriber: STL_MSFT.
rnk added a comment.
I chatted with @rsmith offline and the solution we came up with was to do both of the following:
- make static_assert a keyword under -fms-compatibility (it is a technically non-conforming extension)
- ask @STL_MSFT if `#define static_assert _Static_assert` can be added to the VC assert.h header. This has the benefit of fixing the issue for users with a new VC and an old clang.
- when a fixed assert.h is released, remove this nonconforming keyword from clang, or make it conditional on a new enough _MSC_VER
However, local testing has shown that Visual C++ doesn't recognize _Static_assert, so the second part of this isn't so simple. The problem is that we want users to be able to compile the following conforming C11 code with -fno-ms-compatibility:
#include <assert.h>
static_assert(true, "foo");
The other solution is to have VC assert.h say:
#ifdef __clang__
#define static_assert _Static_assert
#endif
... but maybe it would be better to teach the Visual C++ compiler to recognize the C11 _Static_assert keyword in the first place.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D17444/new/
https://reviews.llvm.org/D17444
More information about the cfe-commits
mailing list