It looks like in the specialization of a static template member of a template
class, the argument names are used from the original declaration, rather than
from the specialization declaration.

template <class T>
struct W {
  template <class S> static S getAsS(const T &v_orig);
};

template <>
template <class S>
inline S W<float>::getAsS(const float &v_spec)
{
    return S(v_spec);
}

the above code compiles on 3.3, but does not compile under 3.4.2 and 3.4.3:

foo.C: In static member function `static S W<T>::getAsS(const T&) [with S = S, T
= float]':
foo.C:10: error: `v_spec' undeclared (first use this function)
foo.C:10: error: (Each undeclared identifier is reported only once for each
function it appears in.)

if you change the second to last line to:

    return S(v_orig);

(using the variable name from the original declaration) the code erroneously
compiles under 3.4.1, 3.4.2, even if the function gets instantiated.

-nick

-- 
           Summary: arguments incorrectly named in static member
                    specialization
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nick at ilm dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to