<html>
    <head>
      <base href="http://bugs.llvm.org/">
    </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 - Clang doesn't align with MSVC/GCC behaviour for an ambiguous method call"
   href="http://bugs.llvm.org/show_bug.cgi?id=32073">32073</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang doesn't align with MSVC/GCC behaviour for an ambiguous method call
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>hughbellars@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The code below fails to compile with GCC (4.9.2) or MSVC (Visual Studio 2015
Update 3). Clang prints "1".

#include <iostream>

void addChild(uint64_t) { std::cout << "1"; }
void addChild(const char*) { std::cout << "2"; }

int main()
{
    addChild(unsigned(0));
}

Fixing this would obviously be a breaking change - I suggest a warning as a
better thing to do.

Obviously in this case, the method call is ambiguous, unsigned(0) can be an
uint64_t(0) or const char*(NULL)

GCC errors:
prog.cpp:10:25: error: call of overloaded 'addChild(unsigned int)' is ambiguous
     addChild(unsigned(0));
                         ^
prog.cpp:10:25: note: candidates are:
prog.cpp:5:6: note: void addChild(uint64_t)
 void addChild(uint64_t) { std::cout << "1"; }
      ^
prog.cpp:6:6: note: void addChild(const char*)
 void addChild(const char*) { std::cout << "2"; }

MSVC errors:
source_file.cpp(10): error C2668: 'addChild': ambiguous call to overloaded
function
source_file.cpp(6): note: could be 'void addChild(const char *)'
source_file.cpp(5): note: or       'void addChild(uint64_t)'
source_file.cpp(10): note: while trying to match the argument list '(unsigned
int)'</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>