[PATCH] D40566: Check if MemberExpr arguments are type-dependent.

Matt Davis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 2 22:01:03 PST 2017


mattd added a comment.

Thanks for the comments Eli!  I agree, it makes sense to flag certain expressions to be type dependent at the earliest time of compilation.  Clang already does this, as the Value/Type dependence is established upon Expr construction from MemberExpr construction.

As we have discussed,  in the case of MemberExpr, Clang bases dependence on the 'this' pointer, which can be seen in the MemberExpr constructor. And from the attached test case, this is decision is not correct.  From what we noted, member access expressions can base their dependence on the type of the member.

However, after trying to propagate this change sooner rather than later (in the MemberExpr ctor), I realized that I might have been changing language semantics.  One thing, in particular, is how we handle address-of expressions.   Clang predicates them, internally, on type-dependence.  From that perspective, we will never try to bind a address-of expression within a template definition, if the address-of is for a member variable.  The bind will only occur during template instantiation.  Another case we have to be aware of are MemberExpr where the member is a CXXMethodExpr, which would be dependent given the implicit 'this' parameter; that's correct, but I don't want to break that either.


https://reviews.llvm.org/D40566





More information about the cfe-commits mailing list