[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

Mark de Wever via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 19 05:12:52 PDT 2023


Mordante added inline comments.


================
Comment at: libcxx/include/__type_traits/is_constant_evaluated.h:31
+  return false;
+#endif
 }
----------------
hazohelet wrote:
> Mordante wrote:
> > Why is this needed? Does this mean the builtin will fail in C++03 mode?
> `__libcpp_is_constant_evaluated` always returns false under C++03 or earlier, where constexpr isn't available. This is a fix to run libc++ tests without seeing warnings from clang with this patch.
> (Live demo: https://godbolt.org/z/oszebM5o5)
I see can you add a comment in that regard? To me it looks like the builtin fails in C++03, where returning false indeed is always the right answer.


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

https://reviews.llvm.org/D155064



More information about the cfe-commits mailing list