diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-07-25 00:48:36 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-07-25 00:48:36 +0000 |
commit | 4e91ea50a01d9d415bb7e78545329781f5f012e2 (patch) | |
tree | f7f327e20c594d127757ac47c237adceaf39b921 /libcxx/test/std/utilities/utility | |
parent | 141b2881d7fb09aa43b2de0af467d02d8f9344a8 (diff) | |
download | bcm5719-llvm-4e91ea50a01d9d415bb7e78545329781f5f012e2.tar.gz bcm5719-llvm-4e91ea50a01d9d415bb7e78545329781f5f012e2.zip |
Don't SFINAE pair's copy assignment operator in C++03 mode.
In C++03 mode evaluating the SFINAE can cause a hard error due to
access control violations. This is a problem because the SFINAE
is evaluated as soon as the class is instantiated, and not later.
llvm-svn: 276594
Diffstat (limited to 'libcxx/test/std/utilities/utility')
-rw-r--r-- | libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp new file mode 100644 index 00000000000..8b9d1ed8905 --- /dev/null +++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// REQUIRES-ANY: c++98, c++03 + +// <utility> + +// template <class T1, class T2> struct pair + +// pair& operator=(pair const& p); + +#include <utility> +#include <memory> +#include <cassert> + + +struct NonAssignable { + NonAssignable() {} +private: + NonAssignable& operator=(NonAssignable const&); +}; + +int main() +{ + // Test that we don't constrain the assignment operator in C++03 mode. + // Since we don't have access control SFINAE having pair evaluate SFINAE + // may cause a hard error. + typedef std::pair<int, NonAssignable> P; + static_assert(std::is_copy_assignable<P>::value, ""); +} |