[cfe-dev] class template methods

Peter Stirling peter at pjstirling.plus.com
Sat May 2 14:06:18 PDT 2015


On 28/04/15 23:31, Reid Kleckner wrote:
> On Wed, Apr 15, 2015 at 10:25 PM, Peter Stirling 
> <peter at pjstirling.plus.com <mailto:peter at pjstirling.plus.com>> wrote:
>
>     Visitor::RequestCompleteType() calls Sema::RequireCompleteType()
>     (which IMO has the wrong name, it returns false on what I would
>     consider, from the name, success).
>
>
> Much has been made about the sense of boolean return values in Clang. 
> It isn't consistent or sane, but such is life. =/
>
>     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?
>
>
> 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.

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.

How do I go about asking for an instantiation of a method on its own?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150502/7e32b480/attachment.html>


More information about the cfe-dev mailing list