template <const long long int lx, const long long int ly, const long long int lz, const long long int cx, const long long int cy, const long long int cz> class rtH{
public: static const long long int sqlc=cx*cx+cy*cy+cz*cz;
static const long long int ldc=lx*cx+ly*cy+lz*cz;
};
template <const long long int lx, const long long int ly, const long long int lz, const long long int cx, const long long int cy, const long long int cz, const long long int r> class rt{
public: static const long long int d=rtH<lx,ly,lz,cx,cy,cz>::ldc-sqrt<rtH<lx,ly,lz,cx,cy,cz>::ldc*rtH<lx,ly,lz,cx,cy,cz>::ldc-(rtH<lx,ly,lz,cx,cy,cz>::sqlc-r*r),20>::value
;
};
int main(){return rt<1,1,1,1,1,1,1>::d;}
The compiler doesn't complain about instantiating rt, so it knows that lx,ly,lz,cx,cy,cz,r are compile time constants. In rtH, I defined sqlc and ldc as const. These const variables only depend on compile-time constants, so they should be also compile-time constants, right? If so, why does the compiler complains about the parameter for sqrt<> isn't a compile-time constant?
Note: sqrt<> works in other places.