public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bkoz at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/29411]  New: unique overload sets for extern "C" vs. C++ function pointers
Date: Tue, 10 Oct 2006 10:07:00 -0000	[thread overview]
Message-ID: <bug-29411-365@http.gcc.gnu.org/bugzilla/> (raw)

>From comment #7 in 29095 we have:

The technical issue is that in the following code:

  extern "C" {
    typedef void (*p1)();
  }
  typedef void (*p2)();

p1 and p2 are distinct types, and, in fact, you can overload based on that. 
G++ doesn't implement that distinction; we don't keep track of language linkage
for types (just for functions) but we should, and, at some point, I'm sure
we'll implement that.  The reason this is in the standard is so that an
implementation can use different calling conventions for C and C++.  So, when
calling through a function pointer you have to know which kind of function
you're calling.  (And, yes, name-mangling is supposed to encode the linkage of
the function type, when mangling a pointer-to-function type.)

End of interesting comment. 

This was news to me, and a quick perusal of "5.1 External Names (a.k.a.
Mangling)" in the IA64 C++ spec doesn't find any matches. However, I can see
why this might be useful, and am curious as to the behavior of pre-3.0.x GNU
compilers, as well as other ABI's (such as microsoft) or EDG in native mode.


-- 
           Summary: unique overload sets for extern "C" vs. C++ function
                    pointers
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ABI
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
  GCC host triplet: all
GCC target triplet: all


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


             reply	other threads:[~2006-10-10 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-10 10:07 bkoz at gcc dot gnu dot org [this message]
2006-10-10 10:09 ` [Bug c++/29411] " bkoz at gcc dot gnu dot org
2006-10-10 16:34 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29411-365@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).