Instantiating virtual member functions in class template


A component of OpenMPI failed to compile with clang, although it
compiles with gcc, pgi, pathcc, xlc, icc, open64 and suncc (according
to OpenMPI developers).

The code boils down to this (tested to be accepted by gcc 4.6.2,
rejected by clang from svn trunk):
=== cut
template<typename T>
void call_less(T T1, T T2)
  T1 < T2;

template<typename T>
class C
  virtual void a() {
    T T1, T2;
    call_less(T1, T2); // Requires operator<
  virtual void z() {}

struct S { int a; }; // No operator<
void test(C<S> *CC)
  CC->z(); // this will not instantiate C<S>::a(), will it?
=== cut

I suspect that C++11 [temp.inst] p10 applies to this code:

It is unspecified whether or not an implementation implicitly
instantiates a virtual member function of a class template
if the virtual member function would not otherwise be

and thus clang behavior is conforming, but I would be thankful if
someone commented on this.