with the following code (a boiled-down version of my original code)
#include
#include
template class A;
auto diff(A
is the problem; regardless of anything else, if X
and Y
are different types, A
and A
are different types and cannot peek at each other's privates. Templates are not covariant!
The specific error here might be an eccentricity of GCC (in that it doesn't spot that X
is the same type as Y
) but the more general case where you might be trying to diff two different types (and why else would you have a separate template type in your diff function?) will never work, regardless of compiler.