Bug 28308 - Language linkage not part of function type
Summary: Language linkage not part of function type
Status: RESOLVED DUPLICATE of bug 2316
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-07 19:28 UTC by Howard Hinnant
Modified: 2006-07-07 20:52 UTC (History)
6 users (show)

See Also:
Host: Darwin ppc
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Howard Hinnant 2006-07-07 19:28:07 UTC
From the C++ standard, 7.5p1:

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

The following code tests for this and should compile (a successful compile indicates a test pass).

template <bool>
struct static_assert;

template<>
struct static_assert<true> {};

extern "C"
{
char myexit(void (*)(void));
typedef void (*CF)(void);
}

int myexit(void (*f)())
{
    static_assert<sizeof(myexit((CF)f)) == 1> e1;
    return myexit((CF)f);
}

int main()
{
}

extern "C"
{
char myexit(void (*)(void))
{
    return 0;
}
}
Comment 1 Andrew Pinski 2006-07-07 20:52:48 UTC

*** This bug has been marked as a duplicate of 2316 ***