hans added a comment. I'm not sure that changing isPotentiallyEvaluated() is the right thing to do. The meaning of that corresponds to text in the standard: https://eel.is/c++draft/expr.typeid#3 so changing it to something that doesn't match the standard exactly seems wrong.
I think it would be safer to do the change purely as an optimization in codegen (maybe we could add a new helper method that could also be used by the warning). Also, I found another interesting test case: https://godbolt.org/z/aW4ojr #include <typeinfo> class B { public: virtual void f(); }; B f(); const std::type_info& g() { return typeid(f()); } Here MSVC warns about /GR- and emits the call to __RTtypeid even though I think it's not necessary since the type is statically known. Actually, if I understand things correctly, f() shouldn't even be evaluated here since the expression is not a glvalue, and Clang gets that right. So that's a case where our codegen is better than MSVC :-) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87425/new/ https://reviews.llvm.org/D87425 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits