c++/510: G++ rejects member template operator specialization

wolfgang.bangerth@iwr.uni-heidelberg.de wolfgang.bangerth@iwr.uni-heidelberg.de
Wed Sep 6 01:16:00 GMT 2000


>Number:         510
>Category:       c++
>Synopsis:       G++ rejects member template operator specialization
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 06 01:16:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
gcc 2.95.2 and 20000905
>Description:
When trying to compile the following code, in which I
explicitely specialize a templates member operator,
-----------------------
template <class T>
struct Example {
    template <class U>  void operator= (U);
};

// specialize class template member function template 
template <> template <>
void Example<double>::operator=<double> (double);
-----------------------
gcc 2.95.2 reports
    y.cc:8: `operator =' not defined
    y.cc:8: confused by earlier errors, bailing out
and, worse, snapshot 20000905 reports
    /tmp/@12358.1:8: `operator=' not defined
    /tmp/@12358.1:8: Internal error #19990331.
    /tmp/@12358.1:8: Internal compiler error in grokdeclarator, at ../gcc/cp/decl.c:9820
    Please submit a full bug report.

The code is valid in my eyes, using the explicit specialization
syntax for function templates. If, by the way, operator=
is renamed to a function `f', then the code passes without
problems.

Regards
  Wolfgang
>How-To-Repeat:
gcc y.cc
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list