[llvm-bugs] [Bug 39068] New: Strange overload resolution with decltype in template function

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 25 01:42:10 PDT 2018


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

            Bug ID: 39068
           Summary: Strange overload resolution with decltype in template
                    function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zamazan4ik at tut.by
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

clang(trunk) for this code:

#include <iostream>

template <typename T> int foo(int) { return 1; }
template <typename T> int foo(decltype(T{})) { return 2; }
template <typename T> int foo(decltype(int(T{}))) { return 3;}

int main()
{
    std::cout << foo<int>(0);
}

prints '1'. But as I understand here should be compilation error because of
ambiguous call to overload function

-- 
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/20180925/fa02647b/attachment.html>


More information about the llvm-bugs mailing list