<html>
    <head>
      <base href="https://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 - Incorrect overload resolution dependent on instantiation order"
   href="https://bugs.llvm.org/show_bug.cgi?id=35077">35077</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect overload resolution dependent on instantiation order
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>kaballo86@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19340" name="attach_19340" title="include-less test case">attachment 19340</a> <a href="attachment.cgi?id=19340&action=edit" title="include-less test case">[details]</a></span>
include-less test case

In the following snippet, the result of overload resolution changes depending
on whether the template argument has been previously instantiated:

    #include <cstdio>
    #include <type_traits>
    using namespace std;

    template <typename ...Ts> struct foo {};

    template <typename T> struct is_foo : std::false_type {};
    template <typename ...Ts> struct is_foo<foo<Ts...>> : std::true_type {};

    ///
    template <typename ...Ts>
    void any_of(...) { 
      puts("true");
    }

    template <typename ...Ts>
    auto any_of(int) -> void_t<enable_if_t<!Ts::value>...> {
      puts("false");
    }

    // sizeof(is_foo<foo<>>); // uncomment-me
    any_of<is_foo<foo<>>>(0); // prints "false"

The result is "false", unless `is_foo<foo<>>` has been instantiated before in
the TU in which case the result is "true".</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>