Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANG
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291278 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index 962ada5..7254745 100644
--- a/include/__config
+++ b/include/__config
@@ -275,10 +275,6 @@
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
#endif
-#if !(__has_feature(cxx_deleted_functions))
-#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-#endif // !(__has_feature(cxx_deleted_functions))
-
#if !(__has_feature(cxx_lambdas))
#define _LIBCPP_HAS_NO_LAMBDAS
#endif
@@ -431,7 +427,6 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_DECLTYPE
-#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
@@ -448,7 +443,6 @@
#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_DECLTYPE
-#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -483,7 +477,6 @@
#if _MSC_VER <= 1800
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#endif
-#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
@@ -739,7 +732,7 @@
#define _LIBCPP_DEFAULT = default;
#endif
-#ifdef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifdef _LIBCPP_CXX03_LANG
#define _LIBCPP_EQUAL_DELETE
#else
#define _LIBCPP_EQUAL_DELETE = delete
diff --git a/include/__debug b/include/__debug
index 19f079b..d95e339 100644
--- a/include/__debug
+++ b/include/__debug
@@ -122,7 +122,7 @@
__i_node* __next_;
__c_node* __c_;
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
__i_node(const __i_node&) = delete;
__i_node& operator=(const __i_node&) = delete;
#else
@@ -145,7 +145,7 @@
__i_node** end_;
__i_node** cap_;
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
__c_node(const __c_node&) = delete;
__c_node& operator=(const __c_node&) = delete;
#else
@@ -232,7 +232,7 @@
__libcpp_db();
public:
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
__libcpp_db(const __libcpp_db&) = delete;
__libcpp_db& operator=(const __libcpp_db&) = delete;
#else
diff --git a/include/__functional_base b/include/__functional_base
index 8589d04..05c9f06 100644
--- a/include/__functional_base
+++ b/include/__functional_base
@@ -552,23 +552,10 @@
return cref(__t.get());
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp> void ref(const _Tp&&) = delete;
template <class _Tp> void cref(const _Tp&&) = delete;
-
-#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-
-template <class _Tp> void ref(const _Tp&&);// = delete;
-template <class _Tp> void cref(const _Tp&&);// = delete;
-
-#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif
#if _LIBCPP_STD_VER > 11
template <class _Tp1, class _Tp2 = void>
diff --git a/include/atomic b/include/atomic
index 7e3fac8..83889fb 100644
--- a/include/atomic
+++ b/include/atomic
@@ -943,16 +943,16 @@
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
__atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) volatile = delete;
-#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#else
private:
__atomic_base(const __atomic_base&);
__atomic_base& operator=(const __atomic_base&);
__atomic_base& operator=(const __atomic_base&) volatile;
-#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#endif
};
#if defined(__cpp_lib_atomic_is_always_lock_free)
@@ -1699,16 +1699,16 @@
_LIBCPP_INLINE_VISIBILITY
atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
atomic_flag(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) volatile = delete;
-#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#else
private:
atomic_flag(const atomic_flag&);
atomic_flag& operator=(const atomic_flag&);
atomic_flag& operator=(const atomic_flag&) volatile;
-#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#endif
} atomic_flag;
inline _LIBCPP_INLINE_VISIBILITY
diff --git a/include/istream b/include/istream
index e935f51..774f38d 100644
--- a/include/istream
+++ b/include/istream
@@ -205,14 +205,9 @@
basic_ios<char_type, traits_type>::swap(__rhs);
}
-#if _LIBCPP_STD_VER > 11
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
basic_istream (const basic_istream& __rhs) = delete;
basic_istream& operator=(const basic_istream& __rhs) = delete;
-#else
- basic_istream (const basic_istream& __rhs); // not defined
- basic_istream& operator=(const basic_istream& __rhs); // not defined
-#endif
#endif
public:
diff --git a/include/ostream b/include/ostream
index be35f2e..3d9be8b 100644
--- a/include/ostream
+++ b/include/ostream
@@ -179,7 +179,7 @@
void swap(basic_ostream& __rhs)
{ basic_ios<char_type, traits_type>::swap(__rhs); }
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
basic_ostream (const basic_ostream& __rhs) = delete;
basic_ostream& operator=(const basic_ostream& __rhs) = delete;
#else
diff --git a/include/type_traits b/include/type_traits
index d7ba251..37692ab 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -489,7 +489,7 @@
}
#endif
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DELETED_FUNCTIONS)
+#if !defined(_LIBCPP_CXX03_LANG)
template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
#endif
@@ -1566,7 +1566,7 @@
struct __nat
{
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
__nat() = delete;
__nat(const __nat&) = delete;
__nat& operator=(const __nat&) = delete;
diff --git a/test/libcxx/iterators/trivial_iterators.pass.cpp b/test/libcxx/iterators/trivial_iterators.pass.cpp
index c4b3aae..d924a57 100644
--- a/test/libcxx/iterators/trivial_iterators.pass.cpp
+++ b/test/libcxx/iterators/trivial_iterators.pass.cpp
@@ -25,9 +25,10 @@
#include <vector>
#include <initializer_list>
+#include "test_macros.h"
#include "test_iterators.h"
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp
new file mode 100644
index 0000000..c5721f2
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream(basic_istream const& rhs) = delete;
+// basic_istream& operator=(basic_istream const&) = delete;
+
+#include <istream>
+#include <type_traits>
+#include <cassert>
+
+struct test_istream
+ : public std::basic_istream<char>
+{
+ typedef std::basic_istream<char> base;
+
+ test_istream(test_istream&& s)
+ : base(std::move(s)) // OK
+ {
+ }
+
+ test_istream& operator=(test_istream&& s) {
+ base::operator=(std::move(s)); // OK
+ return *this;
+ }
+
+ test_istream(test_istream const& s)
+ : base(s) // expected-error {{call to deleted constructor of 'std::basic_istream<char>'}}
+ {
+ }
+
+ test_istream& operator=(test_istream const& s) {
+ base::operator=(s); // expected-error {{call to deleted member function 'operator='}}
+ return *this;
+ }
+
+};
+
+
+int main()
+{
+
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
index 04cb9d3..6e00f39 100644
--- a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <istream>
// template <class charT, class traits = char_traits<charT> >
@@ -17,8 +19,6 @@
#include <istream>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class CharT>
struct testbuf
: public std::basic_streambuf<CharT>
@@ -37,11 +37,8 @@
: base(std::move(s)) {}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
testbuf<char> sb;
test_istream<char> is1(&sb);
@@ -74,5 +71,4 @@
assert(is.precision() == 6);
assert(is.getloc().name() == "C");
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
index bae1e01..6b3f1e2 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
@@ -19,7 +19,9 @@
#include <type_traits>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION { assert(false); }
diff --git a/test/support/test_iterators.h b/test/support/test_iterators.h
index 379933e..a2c22b0 100644
--- a/test/support/test_iterators.h
+++ b/test/support/test_iterators.h
@@ -17,7 +17,7 @@
#include "test_macros.h"
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION