[Bug c++/2316] g++ fails to overload on language linkage

sebor at roguewave dot com gcc-bugzilla@gcc.gnu.org
Sun Sep 11 21:34:00 GMT 2005


------- Additional Comments From sebor at roguewave dot com  2005-09-11 21:34 -------
In reply to comment #6:
The vanilla EDG eccp 3.5 compiles the test case w/o an error:

$ eccp -v t.cpp && ./a.out; echo $?
Edison Design Group C/C++ Front End, version 3.5 (Nov  9 2004 20:00:33)
Copyright 1988-2004 Edison Design Group, Inc.

0

Intel C++ 9.0 (based on eccp 3.4.1) does reject the code, but that's most likely
for compatibility with gcc. I wouldn't rely on its behavior to determine whether
gcc is or isn't correct. (Note that HP aCC 6.0 which is also based on EDG eccp
accepts the code as expected.)

In reply to comment #4:
I don't think DR 4 is related since it's about internal linkage.

The test case is well-formed according to 7.5.1, p1, "Two function types with
different language linkages are distinct types even if they are otherwise
identical."

I.e., the first foo() can only take the address of an extern "C" function as an
argument (and not extern "C++") while the second foo() only an extern "C++"
function (and not extern "C"). Thus, each foo() is a distinct overload.

-- 


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



More information about the Gcc-bugs mailing list