
Maurizio Vitale wrote:
In short, the documentation for enable_if shows that it can be used for selecting a class specialization depending on a predicate. Now Intel C++ refuses to do that and the frontend team at Intel believes this is the right thing to do (although they'll look into the issue further for the sake of compatibility with GCC). Their argument is that the SFINAE rule applies to the selection of the overload set for functions only and not to partial specialization for classes.
I think that the compiler is right to reject your code since the predicate doesn't depend on T. The S in SFINAE stands for 'substitution', and no substitution occurs in your predicate. The instantiation of S<B> can fail even without a reference to foo because your second declaration of foo is ill-formed.