implicit instantiation of undefined template; difference between g++ and clang++

Following is a reduced test case from parsec suite that compiles with g++ and fails to compile with clang++ 3.4:

template class MATRIX_3X3;

template class DIAGONAL_MATRIX_3X3;

template

class SYMMETRIC_MATRIX_3X3

{

public:

void Fast_Solve_Eigenproblem(DIAGONAL_MATRIX_3X3& eigenvalues,

MATRIX_3X3& eigenvectors) const

{

DIAGONAL_MATRIX_3X3 eigenvalues_double;

MATRIX_3X3 eigenvectors_double;

eigenvalues = eigenvalues_double;

eigenvectors = eigenvectors_double;

}

};

The error messages I receive are:

./matrix.hpp: 11:33: error: implicit instantiation of undefined template ‘DIAGONAL_MATRIX_3X3’

./matrix.hpp: 2:25: note: template is declared here

./matrix.hpp:12:24: error: implicit instantiation of undefined template ‘MATRIX_3X3’

./matrix.hpp:1:25: note: template is declared here

2 errors generated

Is there something I am missing - or a way to modify this code to make it compile with clang++?

There are many situations with templates that are "invalid, no
diagnostic required". Clang is more aggressive in many of these cases
(mostly non-dependent expressions inside templates - Clang figures
those out and evaluates them in some places GCC doesn't (I think there
are inverse cases too, where GCC rejects things Clang accepts and both
compilers are correct/allowed to do so)).

You simply have to provide the definition of that template if you want
to write out non-dependent expressions using specializations of it.