[LLVMbugs] [Bug 22919] New: [C++11] overload resolution is failed even though one is more specialized than another

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 16 05:36:19 PDT 2015


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

            Bug ID: 22919
           Summary: [C++11] overload resolution is failed even though one
                    is more specialized than another
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kariya_mitsuru at hotmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14058
  --> https://llvm.org/bugs/attachment.cgi?id=14058&action=edit
clang++ -v

The sample code below should be compiled successfully but clang 3.7.0 rejects
it as ambiguous.

============= sample code =============
template<typename T>
void f(T&) {}

template<int = 0, typename T>
void f(const T&) {}

int main()
{
    const int i = 0;
    f(i);
}
============= sample code =============

cf. http://melpon.org/wandbox/permlink/bYvfmOgSpFN7VD8I


I think that the second one is more specialized.


Note that clang 3.6.0 accepts it.
cf. http://melpon.org/wandbox/permlink/YXMjSpOVkiFT6Hsn

Note also that clang 3.7.0 accepts it if the template parameters are swapped
like below.

============= sample code =============
template<typename T>
void f(T&) {}

template<typename T, int = 0>
void f(const T&) {}

int main()
{
    const int i = 0;
    f(i);
}
============= sample code =============

cf. http://melpon.org/wandbox/permlink/x3CyHr3PlwUmA1H3

-- 
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/20150316/6af47a80/attachment.html>


More information about the llvm-bugs mailing list