c++/2316: gcc 2.97 fails to overload on language linkage

sebor@roguewave.com sebor@roguewave.com
Sun Mar 18 17:46:00 GMT 2001


>Number:         2316
>Category:       c++
>Synopsis:       gcc 2.97 fails to overload on language linkage
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 18 17:46:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     sebor@roguewave.com
>Release:        gcc version 2.97 20010122 (experimental)
>Organization:
>Environment:

>Description:
gcc incorrectly complains about an ambiguity between the
two overloads of foo() in the testcase below. This prevents
the correct implementation of std::bsearch() and
std::qsort() as per 25.4, p3 and 4, respectively.

$ gcc t.cpp
t.cpp: In function `int foo(int (*)())':
t.cpp:8: redefinition of `int foo(int (*)())'
t.cpp:2: `int foo(int (*)())' previously defined here
>How-To-Repeat:
extern "C" {
    int foo (int (*pf)()) { return pf (); }

    int bar () { return 0; }
}

extern "C++" {
    int foo (int (*pf)()) { return pf (); }

    int baz () { return 1; }
}

int main ()
{
    return !(0 == foo (bar) && 1 == foo (baz));
}
>Fix:

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



More information about the Gcc-bugs mailing list