Bug 19731 - arguments incorrectly named in static member specialization
Summary: arguments incorrectly named in static member specialization
Status: RESOLVED DUPLICATE of bug 18962
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.3
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: accepts-invalid, rejects-valid
Depends on:
Reported: 2005-01-31 22:43 UTC by nick
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description nick 2005-01-31 22:43:13 UTC
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.

Comment 1 Andrew Pinski 2005-01-31 22:46:13 UTC
This is a dup of bug 18962 which is already fixed in 3.4.4 and 4.0.0.

*** This bug has been marked as a duplicate of 18962 ***