[Bug c++/17071] New: bogus error taking the address of an overloaded function

sebor at roguewave dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 18 00:40:00 GMT 2004


Gcc 3.4.0 gives an error on the following well-formed test case. In
the call to bar in main the reference to foo should match the ordinary
overload because argument deduction for the template foo fails (13.4,
p2) and thus there's only one function in the overload set.

$ cat t.cpp && g++ --version && g++ -c t.cpp
int foo (int);
template <class T> T foo (T, T);

template <class T, class U> int bar (T, U);

int main ()
{
    bar (0, &foo);
}

g++ (GCC) 3.4.0
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

t.cpp: In function `int main()':
t.cpp:8: error: no matching function for call to `bar(int, <unknown type>)'

-- 
           Summary: bogus error taking the address of an overloaded function
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list