[PATCH] D106302: Implement P1937 consteval in unevaluated contexts

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 6 05:52:18 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang/test/CXX/basic/basic.def.odr/p2-typeid.cpp:53-62
+consteval T *make_t() { return new T; }
+
+void func() {
+  (void)typeid(*null_s());
+  (void)typeid(*make_s());
+  (void)typeid(*null_t()); // expected-warning {{expression with side effects will be evaluated despite being used as an operand to 'typeid'}}
+  (void)typeid(*make_t()); // expected-error {{call to consteval function 'unevaluated::make_t' is not a constant expression}}
----------------
Cleaning up the test a bit to not use relative locations, should be NFC.


================
Comment at: clang/test/SemaCXX/cxx2a-consteval.cpp:11
 
-consteval constexpr int f2(int i) { 
+consteval constexpr int f2(int i) {
   //expected-error at -1 {{cannot combine}}
----------------
Looks like a bunch of unintended whitespace changes snuck in.


================
Comment at: clang/test/SemaCXX/cxx2a-consteval.cpp:608-609
+
+auto e = g(f()); // expected-error {{is not a constant expression}}
+                 // expected-note at -1 {{non-constexpr function 'f' cannot be used in a constant expression}}
+
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106302



More information about the cfe-commits mailing list