<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, May 2, 2015 at 2:06 PM, Peter Stirling <span dir="ltr"><<a href="mailto:peter@pjstirling.plus.com" target="_blank">peter@pjstirling.plus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
<div>On 28/04/15 23:31, Reid Kleckner wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Wed, Apr 15, 2015 at 10:25 PM,
Peter Stirling <span dir="ltr"><<a href="mailto:peter@pjstirling.plus.com" target="_blank">peter@pjstirling.plus.com</a>></span>
wrote:
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div> Visitor::RequestCompleteType() calls
Sema::RequireCompleteType() (which IMO has the wrong
name, it returns false on what I would consider, from
the name, success).<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Much has been made about the sense of boolean return
values in Clang. It isn't consistent or sane, but such is
life. =/</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div> So, I don't construct the specializations for
methods directly in my code, I assume that some of the
instantiation is performed by RequireCompleteType(),
but surely if I checked for SFINAE at that level then
I would lose EVERY methods for std::pair<int const,
int const> and not just the ones that involve
mutation?</div>
</div>
</blockquote>
<div><br>
</div>
<div>I think RequireCompleteType won't instantiate all the
member functions, like operator=, but you can look it up,
and ask for an instantiation of it.</div>
</div>
</div>
</div>
</blockquote>
<br></div></div>
Perhaps I misunderstand what you mean by 'instantiate' but this
doesn't seem to be the case. When I walk the CXXRecordDecl for
'std::pair<int const, int const>' there ARE declarations for
the methods that require mutation. My tool scans the AST for
functions and methods and outputs a file containing functions that
invoke the ones it finds, which is then compiled into a shared
library, so what I want is protection against functions that can't
be called.<br>
<br>
How do I go about asking for an instantiation of a method on its
own?<br>
</div>
</blockquote></div><br></div><div class="gmail_extra">Right, instantiating the class will create decls of all the member functions, but the bodies will be empty because C++ essentially requires that they be parsed lazily. I'd have to lookup the detailed mechanics, but you should be able to look at the method decl, figure out that it needs instantiation, instantiate it, and put the error trap around that.</div></div>