[LLVMbugs] [Bug 15563] New: Function types with different language linkages not distinct

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 21 12:31:27 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: jed at 59a2.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130321/cfdd4a29/attachment.html>


More information about the llvm-bugs mailing list