[PATCH] D55500: [Builtins] Implement __builtin_is_constant_evaluated for use in C++2a

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 10 11:30:37 PST 2018


bruno added a comment.

Hi Eric,

Thanks for working on this!



================
Comment at: include/clang/Basic/Builtins.def:759
+// Random C++ builtins.
+LANGBUILTIN(__builtin_is_constant_evaluated, "b", "ncu", CXX_LANG)
+
----------------
Name bikeshedding : perhaps the builtin name could be detached from the std:: name? Suggestion: `__builtin_in_constant_evaluation_context`


================
Comment at: lib/AST/ExprConstant.cpp:8207
 
+  case Builtin::BI__builtin_is_constant_evaluated:
+    return Success(Info.InConstantContext, E);
----------------
Do we need compat and extension warnings for the use of this builtin before c++2a? I assume people will play with the builtin before the library facility is there. OTOH, since this will be mainly exposed as a library thing, whatever check for c++ version is done at the library level should be enough?


Repository:
  rC Clang

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

https://reviews.llvm.org/D55500





More information about the cfe-commits mailing list