I have a template function. It has well defined semantics so long as the argument is not a pointer type. If someone calls this function passing an argument of type pointer I want to force a compile time error. I have no trouble writing the general (legal) template and the corresponding partially specialized (illegal) version. I just cannot figure out how to defer an error from function definition to function invocation.
Share
You don’t need to specialize it, actually. Just add this in your function body:
This will cause a failure which should be fairly easy to understand.