<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Function types with different language linkages not distinct"
   href="http://llvm.org/bugs/show_bug.cgi?id=15563">15563</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Function types with different language linkages not distinct
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jed@59a2.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>