pair bug in clang (and libc++)

Hi,

It appears that VC11’s STL has found a bug in clang. https://connect.microsoft.com/VisualStudio/feedback/details/747847/type-deduction-fail says “This code is simplified one from clang project and you can get the same error trying to compile clang using vc110.” (They didn’t mention where the offending code was, but it should be easy enough to find.)

The issue is that when A has a user-defined conversion to B and B has a user-defined conversion to C, C++03/VC10 permits pair<A, X> to be converted (explicitly or implicitly) to pair<C, X>, while C++11/VC11 forbids this because A is not implicitly convertible to C.

Presumably, this also indicates that libc++ hasn’t constrained its pair (and tuple!) as specified by C++11. So, two bugs for the price of one.

Stephan T. Lavavej

Visual C++ Libraries Developer

It appears that VC11's STL has found a bug in clang.
Microsoft Connect is Retired - Collaborate | Microsoft Docs
says "This code is simplified one from clang project and you can get the
same error trying to compile clang using vc110." (They didn't mention where
the offending code was, but it should be easy enough to find.)

Thanks for forwarding this on,

The issue is that when A has a user-defined conversion to B and B has a
user-defined conversion to C, C++03/VC10 permits pair<A, X> to be converted
(explicitly or implicitly) to pair<C, X>, while C++11/VC11 forbids this
because A is not implicitly convertible to C.

Yeah, it was surprising this was around as long as it was (as you
point out, in part because of bugs in other libstdc++/libc++) but it
was fixed a few days ago in
http://llvm.org/viewvc/llvm-project?view=rev&revision=158245

Presumably, this also indicates that libc++ hasn't constrained its pair (and
tuple!) as specified by C++11. So, two bugs for the price of one.

Yep, http://llvm.org/bugs/show_bug.cgi?id=13063 fixed in
http://llvm.org/viewvc/llvm-project?view=rev&revision=158280

Thanks again,
- David