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

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #48 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Marc Glisse from comment #39)
> Created attachment 26237 [details]
> remember linkage of a function type (5)

I've been experimenting with this (although updated to more recent GCC), and
one issue I see, functionality-wise, is what happens when an extern "C"
function declaration is followed by a function definition without extern "C"
being specified:

extern "C" {
typedef void (*fpt)();
void f();
}
fpt x = f;
void f() { }
fpt y = f;

The initialisation of x is correctly silently accepted, but the initialisation
of y warns about an invalid conversion.

As I understand the standard, if the first declaration specifies language
linkage, that language linkage is remembered, even if later declarations omit
it. The name f does keep C linkage (as seen by nm), but its type loses it.

Note: it is possible that I made a mistake when updating to newer GCC.

Reply via email to