summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-04-15 18:05:59 +0000
committerEric Fiselier <eric@efcs.ca>2016-04-15 18:05:59 +0000
commit74cba6427a8a3f793ac28b690b26e75a23f47c2b (patch)
treee83ddf0948a64408a7d7963011b0556b2c6b3650 /libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
parentd7d45bf8ceed017b6dcc1f8fab18d5a85b688837 (diff)
downloadbcm5719-llvm-74cba6427a8a3f793ac28b690b26e75a23f47c2b.tar.gz
bcm5719-llvm-74cba6427a8a3f793ac28b690b26e75a23f47c2b.zip
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
Diffstat (limited to 'libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp')
-rw-r--r--libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
index 0cda96846f7..1bd7d6d4e8a 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
@@ -29,8 +29,10 @@ struct ConstructsWithTupleLeaf
ConstructsWithTupleLeaf(ConstructsWithTupleLeaf &&) {}
template <class T>
- ConstructsWithTupleLeaf(T t)
- { assert(false); }
+ ConstructsWithTupleLeaf(T t) {
+ static_assert(!std::is_same<T, T>::value,
+ "Constructor instantiated for type other than int");
+ }
};
int main()
OpenPOWER on IntegriCloud