The following code compiles, and should not :

template<class T>
T f2(const char * s2, T arg2, T arg3);

template<class T>
T f2(const char * s2 = 0, // bug
     T arg2, T arg3) {
  return (s2)?arg2:arg3;
}


Same for the following :


template<class T>
class foo {
  T f2(const char * s2, T arg2, T arg3);
};

template<class T>
T foo<T>::f2(const char * s2 = 0, // bug
             T arg2, T arg3) {
  return (s2)?arg2:arg3;
}


Or for the even simpler


template<class T>
class foo {
  T f2(const char * s2 = 0, T arg2, T arg3); // bug
};

-- 
           Summary: GCC accepts a default value for the first argument of a
                    template function
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Matthieu dot Moy at imag dot fr
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to