[cfe-dev] class template methods

Peter Stirling peter at pjstirling.plus.com
Mon Apr 13 21:57:06 PDT 2015


Hi,

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)

For example:

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.

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?



More information about the cfe-dev mailing list