I have the following code:
#include <iostream>
using namespace std;
template<int k>
struct Base{
int a = k;
};
struct C1 : Base<1>{};
struct C2 : Base<2>{int b;};
typedef Base<1> C1T;
template<
typename BufferType,
typename VerticesType,
VerticesType BufferType::* VerticesField = nullptr
>
void t(){};
int main() {
// WHY this work??
t<C1T , int, &C1T::a>();
// And this not?
// t<C1 , int, &C1::a>();
// ok.
// t< Base<1>, int, &Base<1>::a >();
// also, ok
t<C2 , int, &C2::b>();
return 0;
}
Why I can't call "t" in this way ?
t<C1 , int, &C1::a>();
But instead, I get the following error:
Could not convert template argument ‘&Base<1>::a’ to ‘int C1::*’
P.S. I could understand this behavior if C1 was typedef'ed...