[PATCH] D87425: [CodeGen][typeid] Emit typeinfo directly if type is known at compile-time

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 11:29:55 PDT 2020


zequanwu marked 4 inline comments as done.
zequanwu added inline comments.


================
Comment at: clang/test/SemaCXX/constant-expression-cxx2a.cpp:312
   // expected-note at +1 {{typeid applied to object 'extern_b2' whose dynamic type is not constant}}
-  static_assert(&typeid(extern_b2) == &typeid(B2)); // expected-error {{constant expression}}
+  static_assert(&typeid(*&extern_b2) == &typeid(B2)); // expected-error {{constant expression}}
 
----------------
hans wrote:
> This appears to be changing semantics. It could be that this test is unnecessary strict (that's my understanding), but usually these checks are based on examples in the standard, or the current understanding of the standard. I think it would be best to check with Richard before changing this.
> 
> Actually, I'm surprised this affected since you're only updating CodeGen, not Sema. Is the static_assert really invoking Codegen?
This was caused by my previous changes on isPotentiallyEvaluated, which is used by Sema. I reverted this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87425



More information about the cfe-commits mailing list