This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Stricter semantics for renaming pragmas


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> Ian Lance Taylor <ian@wasabisystems.com> writes:
> 
> [...]
> 
> | > 5) In C++:
> | > 
> | > 5a) Applying __asm__("name") to a declaration silently makes it extern "C".
> | 
> | Sounds right--that doesn't change the calling convention in any way,
> | right?  It just changes the name.
> 
> I don't really like this part.  Changing a "mangled name" should be
> separated from declaring something extern "C", and even more so, that
> declaration should not happen implicitly.  "extern "C" in C++ is not
> just about changing a mangled name, it may affect types too.

Are you refering to this:

typedef void(*function)();

extern "C" void bar(){}

int main()
  {
    function f= &bar; //error.
  }

which I think is an error, but g++ (3.4, and 3.5 20040502) do not emit
    a diagnostic even with pedantic. 7.5/1 says:

    # [...] Two function types witth different language linkages are
    # distinct types even if they are otherwise identical.

and como says:

/*
"ComeauTest.c", line 7: error: a value of type "void (*)() C" cannot
be used to
          initialize an entity of type "function"
      function f= &bar; //error.
                  ^
*/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]