Clang++-3.7 compilation error with CRTP code example

Hi,

In the below code I am trying to use CRTP to use the static member "value" from the Child class in the Parent class. When compiling the code with g++ 5.2.1 with the "-pedantic" flag, I am able to compile without errors or warning, and on execution both c.print_value(); and Child<int,4>::print_value(); print out 4.

DE is not complete while you instantiate the class body of Parent. Using sizeof gives a better diagnostic:

template
struct Parent
{
static const int value = sizeof(DE);

t.cpp:6:30: error: invalid application of ‘sizeof’ to an incomplete type ‘Child<int, 4>’
static const int value = sizeof(DE);
^~~~~~~~~~
t.cpp:14:16: note: in instantiation of template class ‘Parent<Child<int, 4> >’ requested here
struct Child : Parent< Child<T,N> >
^
t.cpp:22:18: note: in instantiation of template class ‘Child<int, 4>’ requested here
Child<int,4> c;
^
t.cpp:14:8: note: definition of ‘Child<int, 4>’ is not complete until the closing ‘}’
struct Child : Parent< Child<T,N> >
^