This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13652] New: GCC gives spurious error for template function overloaded on return type.


GCC fails to compile this valid code.  As per 14.5.5.1/4 a template function 
can be overloaded on the return type.  GCC says #2 ambiguates #1.
VC7.1, Comeau and BCC5.5.1 all accept the code.  See also active issue 271.
Thanks to Rani Sharoni for pointing this out.

template<typename T> long* f(T, char);    // #1
template<typename T> char* f(T, char);  // #2

int main()
{
    typedef char* (*fp1)(int, char);
    fp1 x1 = f;
    x1(3,4);
}

-- 
           Summary: GCC gives spurious error for template function
                    overloaded on return type.
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gprentice at paradise dot net dot nz
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]