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

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 12:04:03 PDT 2020


hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm



================
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}}
 
----------------
zequanwu wrote:
> 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.
Ah, great. That makes more sense :)


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