Cleanup and guard tuple's constructor SFINAE. Fixes PR22806 and PR23256.
authorEric Fiselier <eric@efcs.ca>
Fri, 15 Apr 2016 18:05:59 +0000 (18:05 +0000)
committerEric Fiselier <eric@efcs.ca>
Fri, 15 Apr 2016 18:05:59 +0000 (18:05 +0000)
commit74cba6427a8a3f793ac28b690b26e75a23f47c2b
treee83ddf0948a64408a7d7963011b0556b2c6b3650
parentd7d45bf8ceed017b6dcc1f8fab18d5a85b688837
Cleanup and guard tuple's constructor SFINAE.  Fixes PR22806 and PR23256.

There are two main fixes in this patch.

First the constructor SFINAE was changed so that it's evaluated in two stages
where the first stage evaluates the "safe" SFINAE conditions and the second
evaluates the "dangerous" ones. The key is that the second stage is lazily
evaluated only if the first stage passes. This helps fix PR23256
(https://llvm.org/bugs/show_bug.cgi?id=23256).

The second fix is for PR22806 and LWG issue 2549. This fix applies
the suggested resolution to the LWG issue in order to prevent the construction
of dangling references. The SFINAE for this check is contained within
the _PreferTupleLikeConstructor alias template. The tuple-like constructors
are disabled whenever that trait returns false.

(https://llvm.org/bugs/show_bug.cgi?id=22806)
(http://cplusplus.github.io/LWG/lwg-active.html#2549)

llvm-svn: 266461
libcxx/include/tuple
libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR22806_constrain_tuple_like_ctor.pass.cpp [new file with mode: 0644]
libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp [new file with mode: 0644]
libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp