http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48617
Summary: [C++0x] Problem with non-type template parameters and decltype Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: daniel.krueg...@googlemail.com gcc 4.7.0 in C++0x mode rejects the following program: //--------------- template<class T, decltype(T())> // # struct A {}; A<int, 0> a; int main() {} //--------------- The error message annotated at line # is: "error: 'decltype (T())' is not a valid type for a template constant parameter" It seems to me that according to the FDIS this should be well-formed program: decltype is feasible as a /parameter-declaration/. The new type-equivalence rules in [temp.type] p. 2, "If an expression e involves a template parameter, decltype(e) denotes a unique dependent type. Two such decltype-specifiers refer to the same type only if their expressions are equivalent (14.5.6.1)." should allow for a compiler to deduce the meaning similar to other dependent contexts. See also [temp.dep.type] p. 8 for this matter: "A type is dependent if it is [...] denoted by decltype(expression), where expression is type-dependent (14.6.2.2)."