Skip to content

Commit 1d3964d

Browse files
committed
[libcxx][test] Make LIBCPP_STATIC_ASSERT usable at namespace scope
... even when `!defined(_LIBCPP_VERSION)`. (Note that the previous definition for this case - `((void)0);` - is ill-formed at namespace scope.) Ditto for `LIBCPP_ASSERT`, `LIBCPP_ASSERT_NOEXCEPT`, `LIBCPP_ASSERT_NOT_NOEXCEPT`, and `LIBCPP_ONLY`. Differential Revision: https://reviews.llvm.org/D116880
1 parent eb200e5 commit 1d3964d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libcxx/test/support/test_macros.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@
236236
#define LIBCPP_ASSERT_NOT_NOEXCEPT(...) ASSERT_NOT_NOEXCEPT(__VA_ARGS__)
237237
#define LIBCPP_ONLY(...) __VA_ARGS__
238238
#else
239-
#define LIBCPP_ASSERT(...) ((void)0)
240-
#define LIBCPP_STATIC_ASSERT(...) ((void)0)
241-
#define LIBCPP_ASSERT_NOEXCEPT(...) ((void)0)
242-
#define LIBCPP_ASSERT_NOT_NOEXCEPT(...) ((void)0)
243-
#define LIBCPP_ONLY(...) ((void)0)
239+
#define LIBCPP_ASSERT(...) static_assert(true, "")
240+
#define LIBCPP_STATIC_ASSERT(...) static_assert(true, "")
241+
#define LIBCPP_ASSERT_NOEXCEPT(...) static_assert(true, "")
242+
#define LIBCPP_ASSERT_NOT_NOEXCEPT(...) static_assert(true, "")
243+
#define LIBCPP_ONLY(...) static_assert(true, "")
244244
#endif
245245

246246
#if !defined(_LIBCPP_HAS_NO_RANGES)

0 commit comments

Comments
 (0)