Both are almost on the latest versions of g++ and clang++ in Ubuntu 14.04. The below code compiles fine with g++.
template<typename T>
struct B { static const int i = T::value; };
struct D : B<D> { static const int value = 0; } d;
int main () {}
However, with clang++ (even with -std=c++11), below error is thrown:
error: no member named 'value' in 'D'
struct B { static const int i = T::value; };
~~~^
note: in instantiation of template class 'B<D>' requested here
struct D : B<D> { static const int value = 0; } d;
Is it a non-standard code?
Above example is just a snippet of a bigger code which has to be ported to iOS/Android. iOS supports clang and I am not sure, how it will work out.
Any help is appreciated.