<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">This does sound promising, but I'm not
      sure how to make use of it.<br>
      <br>
      At the moment my walker (which is based on clang::ASTConsumer) has
      a handler for class templates that looks like:<br>
      <br>
      void Walker::TraverseClassTemplate(clang::ClassTemplateDecl const*
      d) {<br>
        TRACE(1, "walk template " + getDeclMetadataString(d));<br>
      <br>
        bool was = inInstantiation;<br>
        inInstantiation = true;<br>
      <br>
        for(auto decl : d->specializations()) {<br>
          visitor->RequestCompleteType(decl);<br>
          TraverseCXXRecord(decl);<br>
        }<br>
      <br>
        inInstantiation = was;<br>
      }<br>
      <br>
      Visitor::RequestCompleteType() calls Sema::RequireCompleteType()
      (which IMO has the wrong name, it returns false on what I would
      consider, from the name, success).<br>
      <br>
      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?<br>
      <br>
      On 14/04/15 18:26, Richard Smith wrote:<br>
    </div>
    <blockquote
cite="mid:CAOfiQq=CxiFBFdnC3gVTUPAPH7mFCWvm0iTD5N25cJsJQ59CLg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Tue, Apr 14, 2015 at 8:38 AM, Reid
            Kleckner <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">Sounds a lot like a SFINAE test. Assuming
                you already have an AST with the class template
                instantiation, then you'd attempt to instantiate the
                assignment operator inside a SFINAETrap. Instantiation
                will either pass or fail and you'll get your answer, and
                you should be able to continue compilation or further
                queries normally.</div>
            </blockquote>
            <div><br>
            </div>
            <div>I think the above is about the best that you can do.</div>
            <div><br>
            </div>
            <div>One note: if an error occurs outside of the immediate
              context of the substitution, a SFINAETrap will not
              suppress it (which is actually a good thing in this case,
              because you cannot continue compilation normally after
              such an error -- any part of the AST that failed may be
              marked invalid, suppressing further errors in other
              contexts).</div>
            <div><br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div class="HOEnZb">
                <div class="h5">
                  <div class="gmail_extra">
                    <div class="gmail_quote">On Mon, Apr 13, 2015 at
                      9:57 PM, Peter Stirling <span dir="ltr"><<a
                          moz-do-not-send="true"
                          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">Hi,<br>
                        <br>
                        Is there a way to ask clang whether a method for
                        an instantiation of a class template would be an
                        error to call? (I only need yes/no)<br>
                        <br>
                        For example:<br>
                        <br>
                        std::pair has assignment operators defined, but
                        for the instantiation std::pair<int const,
                        int const> calling the assignment operators
                        is an error, because you can't assign to int
                        const.<br>
                        <br>
                        If clang can't tell me this, I'm looking at
                        generating a translation unit with a call to the
                        method, and then checking whether there was an
                        error compiling it. Given that I will need to do
                        this once per method, per instantiation, per
                        template, (which looks to be in the thousands
                        based on a test I just did) what is the best way
                        to do this?<br>
                        _______________________________________________<br>
                        cfe-dev mailing list<br>
                        <a moz-do-not-send="true"
                          href="mailto:cfe-dev@cs.uiuc.edu"
                          target="_blank">cfe-dev@cs.uiuc.edu</a><br>
                        <a moz-do-not-send="true"
                          href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"
                          target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
              <br>
              _______________________________________________<br>
              cfe-dev mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
              <a moz-do-not-send="true"
                href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"
                target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
              <br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>