This is the mail archive of the gcc-bugs@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]

c++/8680: g++ doesn't warn when passing a C++ funcptr instead of extern "C" funcptr


>Number:         8680
>Category:       c++
>Synopsis:       g++ doesn't warn when passing a C++ funcptr instead of extern "C" funcptr
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 22 09:16:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Marlow
>Release:        unknown-1.0
>Organization:
>Environment:
Solaris 8, GCC version 3.2
>Description:
extern "C" is now part of functions type in C++. This means that function type matching must take this into account. The attached program has an extern "C" function that takes a function pointer parameter. This should also be treated as a function with extern "C" (see the standard, section 7.5 clause 4) so when a function pointer is passed the compiler should check that it has extern "C" linkage. If it doesn't then at least a warning should be issued. The Solaris Forte 6.2 compiler DOES issue such a warning.
>How-To-Repeat:
Compile the attached file, g++ -c -Wall -pedantic bug.cpp
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="bug.cpp"
Content-Disposition: inline; filename="bug.cpp"

extern "C" {
void doSomething(int, void*(*)(void*));
};

void* func(void*);

int main()
{
    doSomething(1, func);
    return 0;
}



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