Note: gcc
and clang
are showing the correct behavior...
THE BUG IS IN icc
!
The snippet accepted by both gcc and clang is legal and should not trigger a diagnostic.
The author responsible for the code inside icc
that issues the provided diagnostic did probably trip over the below snippet, taken from the Standard, which says that names in a Base
that depends on a template-parameter should not be available inside the definition of the Derived
class.
14.6.2 Dependent Names
[temp.dep]
3 In the definition of a class or class template, if a base class depends on a template-parameter, the base class scope is not examined during unqualified name lookup either at the point of definition of the class template or member or during an instantiation of the class template or member.
As stated it is important to note that [temp.dep]p3
says that the base class scope is not examined in the definition of a class, it doesn't say that such names are not inherited when being accessed from the outside.
Your "work around" shows that the name (in this case template<int> struct Nested
) is indeed (correctly) inherited and available inside A<1, true>
, but icc
seems to confuse explicit instantiation with the rules of names inside the definition of the class.