From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27019 invoked by alias); 1 Mar 2014 18:17:21 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26944 invoked by uid 48); 1 Mar 2014 18:17:18 -0000 From: "harald at gigawatt dot nl" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/2316] g++ fails to overload on language linkage Date: Sat, 01 Mar 2014 18:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 2.97 X-Bugzilla-Keywords: ABI, accepts-invalid, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: harald at gigawatt dot nl X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-03/txt/msg00034.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2316 Harald van Dijk changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #48 from Harald van Dijk --- (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.