Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8557635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:37:04+00:00 2026-06-11T15:37:04+00:00

From the C++11 draft, 7.5 (para. 1): Two function types with different language linkages

  • 0

From the C++11 draft, 7.5 (para. 1):

Two function types with different language
linkages are distinct types even if they are otherwise identical.

So I can do overload based on language linkages:

extern "C" typedef void (*c_function)();
typedef void (*cpp_function)();

void call_fun(c_function f)
{
}
void call_fun(cpp_function f)
{
}

extern "C" void my_c()
{
}
void my_cpp()
{
}
int main()
{
    call_fun(my_c);
    call_fun(my_cpp);
}

But, with GCC 4.7.1 this sample code gives the error messages:

test.cpp: In function 'void call_fun(cpp_function)':
test.cpp:7:6: error: redefinition of 'void call_fun(cpp_function)'
test.cpp:4:6: error: 'void call_fun(c_function)' previously defined here

And with CLang++ :

test.cpp:7:6: error: redefinition of 'call_fun'
void call_fun(cpp_function f)
     ^
test.cpp:4:6: note: previous definition is here
void call_fun(c_function f)
     ^

Now the questions:

  • Is my understanding of the standard correct? Is this code valid?

  • Does anybody know if these are bugs in the compilers or if they are intentionally doing it that way for compatibility purposes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:37:06+00:00Added an answer on June 11, 2026 at 3:37 pm

    It’s a known bug in gcc, and they record that it’s non-conforming since this bug blocks the uber-bug, “C++98 conformance issues”.

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

    Check the creation date.

    There’s some discussion towards the end, about the practicalities of introducing a fix. So the answer to your last question is “both”: it’s a bug and the bug has intentionally been left in for compatibility.

    Other compilers with the same issue might have made the error independently, but I think more likely they also know that it’s wrong but want to be bug-compatible with gcc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A point from n3290 ISO draft: Lambda expressions : section 5.1.2, para 6: The
A point from ISO draft N3290 : Unqualified Name Lookup :section 3.4.1, para 14:
I know that even the offline_access token got from Facebook can be invalid (in
INSERT INTO options (owner, name, value, modified) SELECT owner, name, value, modified, @draft:=draft FROM
I have a Wordpress Front End Form to Publish/Draft Posts directly from my theme:
From this context: import itertools lines = itertools.cycle(open('filename')) I'm wondering how I can implement
From 2.13.2/3 The double quote and the question mark ? , can be represented
A point from the ISO C++ Draft n3290 : 3.4.0 2nd point A name
A point from ISO C++ DRAFT n3290 :Argument dependant Name Lookup : section 3.4.2,
A point from ISO draft n3290 section 3.3.9 paragraph 4: The declarative region of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.