http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49051

--- Comment #2 from Johannes Schaub <schaub.johannes at googlemail dot com> 
2011-05-19 16:26:30 UTC ---
(In reply to comment #1)
> I disagree.  The transformation of array to pointer is done immediately at
> declaration time (8.3.5/6), so there is no substitution into an array type.  
> In
> resolving issue 1001, core agreed that the transformations in 8.3.5/6 are done
> at template definition time, not deferred until the instantiation.
> 
> http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_closed.html#1001
> http://wiki.dinkumware.com/twiki/bin/view/Wg21batavia/CoreWorkingGroup#Core_issue_1001_Parameter_type_a

jason, the transformation is immediately done at declaration time. I agree:
That's why these two are equivalent:

    template<typename T> void f(T[1]);
    template<typename T> void f(T*);

For equivalence, both shall have identical parameter-type-lists, which these
have. But before argument deduction, explicit template arguments are
substituted, and those explicit arguments are substituted into the *unadjusted*
parameter type. See 14.8.2p3 (FDIS):

"After this substitution is performed, the function parameter type adjustments
described in 8.3.5 are performed."

The note that contains a list of substitution failures also has an example like
that at 14.8.2p8:

   template <class T> int f(T[5]);
   int I = f<int>(0);
   int j = f<void>(0); // invalid array

Reply via email to