public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32042]  New: linkage confused with scope?
@ 2007-05-22 14:56 andrew dot stubbs at st dot com
  2007-05-24  2:12 ` [Bug c++/32042] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 4+ messages in thread
From: andrew dot stubbs at st dot com @ 2007-05-22 14:56 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-04  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-32042-4@http.gcc.gnu.org/bugzilla/>
2021-08-26 20:38 ` [Bug c++/32042] linkage confused with scope? pinskia at gcc dot gnu.org
2021-08-26 22:16 ` pinskia at gcc dot gnu.org
2021-12-04  8:12 ` pinskia at gcc dot gnu.org
2007-05-22 14:56 [Bug c++/32042] New: " andrew dot stubbs at st dot com
2007-05-24  2:12 ` [Bug c++/32042] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).