[libcxx-commits] [PATCH] D127978: [libc++][test] Replaces TEST_IS_CONSTANT_EVALUATED.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 17 12:23:56 PDT 2022


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


================
Comment at: libcxx/test/support/constant_evaluated.h:18
+namespace TestedCppVersion {
+enum Enum {
+  Cpp14,
----------------
philnik wrote:
> Can't this be an anonymous enum? Or is this an extension?
No it can't; it's used as an argument to `is_constant_evaluated`.


================
Comment at: libcxx/test/support/constant_evaluated.h:27-31
+#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
+#  define IS_CONSTANT_EVALUATED std::is_constant_evaluated()
+#elif TEST_HAS_BUILTIN(__builtin_is_constant_evaluated)
+#  define IS_CONSTANT_EVALUATED __builtin_is_constant_evaluated()
+#endif
----------------
philnik wrote:
> I think I'd rather have this in it's own function instead of a macro.
But that function would also need macros, right?
I can add a function that only returns the status of "IS_CONSTANT_EVALUATED" and keep the version dependent logic here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127978



More information about the libcxx-commits mailing list