<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJylVVuPmzoQ_jXkxQoikOsDD7lstNG23Z5NpPYtMjCAW4ORbXaz__7MmIQkPbvSkYoswGPm9n0zQ6Ky9_hQCsMarQrNK1ZynQ1Ba6UNs_pd1AWziqWqaiRYYN40eFQyA-1F6119EXvRAx540YolrWXCMlOqVma1F86s7wUbL1h2d4aXsbpNLbvVXl1PLaCQk3CdSm4MO6Dxi07nmnmzFTswS_5EbdmJXrzZ5n_Y4S0mk3vhnNTDBRuSMINU2vcGUGz9E4rvDL0qkTkV3_c_PLNg0NaczGFg10O6vGiJK3fH80-AC5eoWrdSNlb_6YCyuoFvZxlvGuDEjWIVMFtyizcg-hIJFUMmS9CYyhqhIba-KPW7bb5ClYB-ODXa8bS8NUqSbp3deuEWF3uBVL0i2rlWFcsUuk5TMAac70Yh8qANOQK_8HubvTpSgJjibpkrdZNUf4xiP-G6l09WhPBkc81e5MwhN9qZJVbkG-6muNh3q4m4Aux3FwYcOvYQPZILQ6Hr7Co9K95z02HyjVcYP1h6Pok66xVGXrRhGywNrrkVqqYPOjrXP39uoKtI5fQ_oH7vbwQv0Nhz80WlhFJGe6eP3XUkbNIS0t_HyoVx1JAjb3UKR9MWBZpHl1QNdyFTQa1xsRU3LunLHlFAX2eYXDjX74h1yvAKEG72qtUpvPC6OEP0iaOtOO3sI5nvUteAPfUC2FopVOC89hl6YTh0BR3elvGt4WtltdoA44bxuuvBrrb824970pEHBPt-TDCmwba6Zv-p73C-p2Be6HZJn957cNasj3hPn_6Z-UfXc_JrvasaKgfSe-TmcJ4vS124Jrjsn34425-08W1H37dddz9QPxus3jrDBAkl8Qos5VJS033czgiOwIrBmXCeKlg5TOVuLBy7Ps2GVh1ZN-PW7K0UaUmTosamfn6iNnvDg5kGmhmc7be7b8sHtIaaJ-sPsjjKFtGCD3B6lkrH_7TtqZGtUTUMWi3j0trGUH04dgthyzbxMRbcSPl6eQxxRP2CFCtmK4xpAVHbTsLFLBiUcTqeBFOI5os8n455AHk0ngbpHEbZIs3CyWwgeQLSxDgjsLoQ3pVb4bnqNJBhM3zlUmQknmwGfx-WiMMgDINREIVhFE3mfhAFIz4ZJbNRnk1n09QbB1BxIX2y4ytdDHTsTCYt1sQ4kMJYcz3En5AoagCXBUZohZUQd2DTbxapbPD3g4QqYuE8YdmbVnUh34nlbvT2_2I397sBiOwZx-_AJRG7DP4Fe4VS1w>52970</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
SFINAEing `p.x` on a pointer wrongly tries to complete the pointee's type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++,
rejects-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Quuxplusone
</td>
</tr>
</table>
<pre>
This program hard-errors trying to complete `Holder<Incomplete>`; but it shouldn't.
struct Incomplete;
template<class T> struct Holder { T t; int x; };
template<class T> auto f(T t) -> decltype(t.x);
void f(...);
void test() {
::f((Holder<Incomplete>*)nullptr);
}
It appears to me that the problem is here, in `LookupMemberExpr`:
```
// Recover from dot accesses to pointers, e.g.:
// type *foo;
// foo.bar
[...]
if (!IsArrow && Ptr->getPointeeType()->isRecordType() &&
MemberName.getNameKind() != DeclarationName::CXXDestructorName) {
S.Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
<< BaseType << int(IsArrow) << BaseExpr.get()->getSourceRange()
<< FixItHint::CreateReplacement(OpLoc, "->");
// Recurse as an -> access.
IsArrow = true;
return LookupMemberExpr(S, R, BaseExpr, IsArrow, OpLoc, SS,
ObjCImpDecl, HasTemplateArgs, TemplateKWLoc);
}
}
```
That second recursive call to `LookupMemberExpr` triggers completion of the _pointed-to_ type, which is not OK if we're in a SFINAE context.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVVtvozoQ_jXkxQoi0ITkgYdcGjXqnu2eJtLZt8jAAN41GNmmTf_9mTEJSfa00kEW4D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