<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><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 13, 2015 at 9:57 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">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>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>