<html>
    <head>
      <base href="https://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 --- - clang reports an error instead of applying SFINAE"
   href="https://llvm.org/bugs/show_bug.cgi?id=24894">24894</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang reports an error instead of applying SFINAE
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>blastrock@free.fr
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14919" name="attach_14919" title="minimal test case">attachment 14919</a> <a href="attachment.cgi?id=14919&action=edit" title="minimal test case">[details]</a></span>
minimal test case

Hi,

I reduced my problem to the attached file, compile with clang++ -std=c++11.
This code fails to compile with clang 3.4 and 3.7 but compiles fine with g++
4.8 and 5.2.

I made two template overloads of the flex() function and I'm calling one of
them in the main() function. I explicitly set the first argument template to
"void(int)" which should make the first candidate impossible to instantiate
because it would try to instantiate a T argument which is not instantiatable.

The problem is that when clang tries to instantiate the first candidate, it
fails on the "boost::bind" part of the decltype (and not because of T not being
instantiatable) because somewhere in boost::bind internals, something breaks,
which is fine by me. But then it spits out an error about that and does not try
to instantiate the second candidate, which breaks the principle of SFINAE.

g++ instead correctly fails to instantiate the first candidate and succeeds in
instantiating the second one, thus giving no error.</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>