[llvm-bugs] [Bug 24894] New: clang reports an error instead of applying SFINAE

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 21 06:16:13 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24894

            Bug ID: 24894
           Summary: clang reports an error instead of applying SFINAE
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: blastrock at free.fr
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 14919
  --> https://llvm.org/bugs/attachment.cgi?id=14919&action=edit
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.

-- 
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/20150921/e0905a4d/attachment.html>


More information about the llvm-bugs mailing list