------- Comment #2 from gcc dot gnu dot org at chosenones dot dyndns dot org 2006-06-16 12:59 ------- I'm not entirely sure myself, but:
Section 14.6.7 "When looking for the declaration of a name used in a template function definition or static data member template definition, the usual lookup rules _basic.lookup.unqual_, _basic.lookup.koenig_) are used for non-dependent names. The lookup of names dependent on the template arguments is postponed until the actual template argument is known (_temp.dep_)." Section 14.6.2.3.1 seems to make this a value-dependent expression: "1 Except as described below, a constant expression is value-dependent if any subexpression is value-dependent." Section 14.6.2.4 "An integral non-type template argument is dependent if the constant expression it specifies is value-dependent." So, it seems to be a dependent name, and in other contexts, the lookup of dependent names is delayed. Also, existing practice and common sense seem to suggest that this be default. In any case, an ICE is probably not what should happen. Comeau C/C++ 4.3.3: Compiles MSVC 7.1: Compiles That expression as -- A static member initializer: Compiles -- A default function argument: Compiles A nested type expression of the same form as -- A base class: Compiles -- A nested type specifier [typedef]: Compiles -- Function return type or argument type: Compiles -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28048