------- Additional Comments From bangerth at dealii dot org  2005-02-28 15:53 
-------
I believe the code is invalid: you try to do a partial specialization of 
a member function, but there is no such thing -- you need to use an overload 
instead. To me this looks like an accept-invalid. Here's what icc has to 
say: 
 
g/x> icc -Xc -ansi -c x.cc 
x.cc(10): error: declaration is incompatible with function template "void 
A<AT>::function(T) [with AT=int]" (declared at line 5) 
  void A<int>::function(TTT *){std::cerr << '2';} 
               ^ 
 
x.cc(16): warning #592: variable "b" is used before its value is set 
    a.function(b); 
               ^ 
 
compilation aborted for x.cc (code 2) 
 
This also seems like a regression to me, since gcc2.95.3 gives me this: 
g/x> /home/bangerth/bin/gcc-2*/bin/c++ -c x.cc -ansi -pedantic 
x.cc:10: template parameters specified in specialization 
x.cc:10: prototype for `void A<int>::function(TTT *)' does not match any in 
class `A<int>' 
x.cc:5: candidate is: template <class T> void A<int>::function<T>(T) 
x.cc: In method `void A<int>::function(TTT *)': 
x.cc:10: must specialize `struct A<int>' before defining member `void 
A<int>::function(TTT *)' 
x.cc:10: template definition of non-template `void A<int>::function(TTT *)' 
 
W. 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.2.3 3.3.5 3.4.3 4.0.0
      Known to work|                            |2.95.3
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-28 15:54:00
               date|                            |
            Summary|Wrong template function     |[3.3/3.4/4.0/4.1 regression]
                   |specialization chosen       |gcc accepts invalid partial
                   |                            |specialization attempt of
                   |                            |member function
   Target Milestone|---                         |3.4.4


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

Reply via email to