http://llvm.org/bugs/show_bug.cgi?id=15563

            Bug ID: 15563
           Summary: Function types with different language linkages not
                    distinct
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Section 7.5.1 of C++98 and C++11 states:

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

If the types are distinct, then surely we can overload on that basis:

    extern "C" typedef int (*CPtr)(void);
    extern "C++" typedef int (*CxxPtr)(void);

    int Klutz(CPtr f) { return f(); }
    int Klutz(CxxPtr f) { return f(); }

This compiles cleanly with Sun and Cray C++ compilers, but not with Clang, GCC,
Intel, MSVC, IBM XL, PathScale, or PGI.

    $ clang++ klutz.cc
    klutz.cc:5:5: error: redefinition of 'Klutz'
    int Klutz(CxxPtr f) { return f(); }
        ^
    klutz.cc:4:5: note: previous definition is here
    int Klutz(CPtr f) { return f(); }
        ^
    1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to