[PATCH] CodeGen: Properly null-check typeid expressions

Richard Smith richard at metafoo.co.uk
Fri Jul 18 13:25:17 PDT 2014


================
Comment at: lib/CodeGen/CGExprCXX.cpp:1632
@@ +1631,3 @@
+  if (const auto *ACO = dyn_cast<AbstractConditionalOperator>(E))
+    return isGLValueFromPointerDeref(ACO->getTrueExpr()) ||
+           isGLValueFromPointerDeref(ACO->getFalseExpr());
----------------
Do you need to walk through `OpaqueValueExpr`s to support this for binary conditional operators? Does this work:

  struct T { operator bool(); } *p, t, &q = t;
  typeid(*p ?: q);

http://reviews.llvm.org/D4592






More information about the cfe-commits mailing list