C++14 partial ordering of function templates: MSVC 14 vs clang

Hello

As you might already know, MSVC 14 (Visual Studio 2015) is in its
testing phase currently. I stumbled upon a bug report that caught my
attention: https://connect.microsoft.com/VisualStudio/Feedback/Details/1114187

The author of this report complains that in the given example he
attached (http://pastebin.com/R5z88xcf) the call to function 'f'
should be unambiguous (MSVC 14 thinks otherwise) according to 14.8.2.4
paragraph 10 in the standard. In response, Visual C++ developer
Jonathan Caves argues that: "[14.8.2.4] has been recently re-written
as the result of a defect report against the C++ language [...]
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1705
[...] So partial ordering fails and the function call is ambiguous."

Compiling the example in question (http://pastebin.com/R5z88xcf),
clang 3.5 and 3.6 think the call to f is unambiguous, MSVC14 thinks
it's ambiguous. My question is: which compiler is right about this? :slight_smile:

Thanks,
Peter

AMDG

That's not how it works; Jon Caves' explanation in the MS bug report is
correct. Clang 3.6 did not implement DR1705; Clang SVN does (at least,
partially), so we now report this case as being ambiguous. T& is better
than T&&, const U& is better than U&, but A<V> is better than V, so the
templates are not ordered and the call is ambiguous.