[PATCH] D22476: [AST] Make MemberExpr non-dependent according to core issue 224

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 18 14:25:20 PDT 2016


rsmith added inline comments.

================
Comment at: lib/AST/Expr.cpp:1425
@@ +1424,3 @@
+
+  if (E->isTypeDependent() && isa<CXXThisExpr>(base)) {
+    bool MemberOfCurrentInstantiation = true;
----------------
The language rule for this says nothing about the base being a `this` expression; there are many other ways in which a `MemberExpr` could name a member of the current instantiation.

In general, the base expression should have (pointer to) `RecordType` or `InjectedClassNameType` as its type (that is, `getAsCXXRecordDecl()` should succeed) in all cases except when the member access denotes a member of an unknown specialization.

================
Comment at: lib/AST/Expr.cpp:1454
@@ +1453,3 @@
+    if (MemberOfCurrentInstantiation && !memberdecl->getType()->isDependentType())
+      E->setTypeDependent(false);
+  }
----------------
Please assert that `ty` is not a dependent type here.


https://reviews.llvm.org/D22476





More information about the cfe-commits mailing list