The following code defines the same external function twice, once with C++
linkage, and once with C linkage. GCC 4.1.1 does not complain.

void
foo ()
{
  extern int f(int);
}

extern "C" int f(int i);  // conflict

However, the following example is properly rejected:

extern int f(int);
extern "C" int f(int i);  // conflict

EDG rejects both examples.

It would appear that the only difference is that the C++ function is not
visible in the scope when the C function is defined, but they can't both have
external linkage.


-- 
           Summary: linkage confused with scope?
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andrew dot stubbs at st dot com


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

Reply via email to