Update issue status for LWG 2768 and 2769
authorEric Fiselier <eric@efcs.ca>
Sun, 16 Oct 2016 01:43:43 +0000 (01:43 +0000)
committerEric Fiselier <eric@efcs.ca>
Sun, 16 Oct 2016 01:43:43 +0000 (01:43 +0000)
llvm-svn: 284321

libcxx/include/any
libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp [new file with mode: 0644]
libcxx/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
libcxx/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
libcxx/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp [deleted file]
libcxx/www/upcoming_meeting.html

index 69fdbdd..8fe9e8f 100644 (file)
@@ -579,7 +579,8 @@ _ValueType any_cast(any const & __v)
 {
     using _RawValueType = __uncvref_t<_ValueType>;
     static_assert(is_constructible<_ValueType, _RawValueType const &>::value,
-                  "ValueType is required to be a reference or a CopyConstructible type");
+                  "ValueType is required to be a const lvalue reference "
+                  "or a CopyConstructible type");
     auto __tmp = _VSTD::any_cast<add_const_t<_RawValueType>>(&__v);
     if (__tmp == nullptr)
         __throw_bad_any_cast();
@@ -592,7 +593,8 @@ _ValueType any_cast(any & __v)
 {
     using _RawValueType = __uncvref_t<_ValueType>;
     static_assert(is_constructible<_ValueType, _RawValueType &>::value,
-                  "ValueType is required to be a reference or a CopyConstructible type");
+                  "ValueType is required to be an lvalue reference "
+                  "or a CopyConstructible type");
     auto __tmp = _VSTD::any_cast<_RawValueType>(&__v);
     if (__tmp == nullptr)
         __throw_bad_any_cast();
@@ -605,7 +607,8 @@ _ValueType any_cast(any && __v)
 {
     using _RawValueType = __uncvref_t<_ValueType>;
     static_assert(is_constructible<_ValueType, _RawValueType>::value,
-                  "ValueType is required to be an rvalue reference or a CopyConstructible type");
+                  "ValueType is required to be an rvalue reference "
+                  "or a CopyConstructible type");
     auto __tmp = _VSTD::any_cast<_RawValueType>(&__v);
     if (__tmp == nullptr)
         __throw_bad_any_cast();
diff --git a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
new file mode 100644 (file)
index 0000000..07578a2
--- /dev/null
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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, c++11, c++14
+
+// <any>
+
+// template <class ValueType>
+// ValueType any_cast(any &&);
+
+// Try and use the rvalue any_cast to cast to an lvalue reference
+
+#include <any>
+
+struct TestType {};
+using std::any;
+using std::any_cast;
+
+void test_const_lvalue_cast_request_non_const_lvalue()
+{
+    const any a;
+    // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+    // expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
+    any_cast<TestType &>(a); // expected-note {{requested here}}
+
+    const any a2(42);
+    // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+    // expected-error@any:* {{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
+    any_cast<int&>(a2); // expected-note {{requested here}}
+}
+
+void test_lvalue_any_cast_request_rvalue()
+{
+    any a;
+    // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+    any_cast<TestType &&>(a); // expected-note {{requested here}}
+
+    any a2(42);
+    // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+    any_cast<int&&>(a2); // expected-note {{requested here}}
+}
+
+void test_rvalue_any_cast_request_lvalue()
+{
+    any a;
+    // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+    // expected-error@any:* {{non-const lvalue reference to type 'TestType' cannot bind to a temporary}}
+    any_cast<TestType &>(std::move(a)); // expected-note {{requested here}}
+
+    // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+    // expected-error@any:* {{non-const lvalue reference to type 'int' cannot bind to a temporary}}
+    any_cast<int&>(42);
+}
+
+int main()
+{
+    test_const_lvalue_cast_request_non_const_lvalue();
+    test_lvalue_any_cast_request_rvalue();
+    test_rvalue_any_cast_request_lvalue();
+}
index 59294e7..3f6955a 100644 (file)
@@ -29,18 +29,18 @@ int main()
     any a;
 
     // expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
-    // expected-error@any:* {{static_assert failed "ValueType is required to be a reference or a CopyConstructible type"}}
+    // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
     any_cast<TestType &>(static_cast<any const&>(a)); // expected-note {{requested here}}
 
     // expected-error@any:* {{cannot cast from lvalue of type 'const TestType' to rvalue reference type 'TestType &&'; types are not compatible}}
-    // expected-error@any:* {{static_assert failed "ValueType is required to be a reference or a CopyConstructible type"}}
+    // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
     any_cast<TestType &&>(static_cast<any const&>(a)); // expected-note {{requested here}}
 
     // expected-error@any:* {{binding value of type 'const TestType2' to reference to type 'TestType2' drops 'const' qualifier}}
-    // expected-error@any:* {{static_assert failed "ValueType is required to be a reference or a CopyConstructible type"}}
+    // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
     any_cast<TestType2 &>(static_cast<any const&&>(a)); // expected-note {{requested here}}
 
     // expected-error@any:* {{cannot cast from lvalue of type 'const TestType2' to rvalue reference type 'TestType2 &&'; types are not compatible}}
-    // expected-error@any:* {{static_assert failed "ValueType is required to be a reference or a CopyConstructible type"}}
+    // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
     any_cast<TestType2 &&>(static_cast<any const&&>(a)); // expected-note {{requested here}}
 }
index 13e1a55..ed4b96d 100644 (file)
@@ -42,11 +42,11 @@ struct no_move {
 
 int main() {
     any a;
-    // expected-error@any:* {{static_assert failed "ValueType is required to be a reference or a CopyConstructible type"}}
+    // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
     // expected-error@any:* {{static_cast from 'no_copy' to 'no_copy' uses deleted function}}
     any_cast<no_copy>(static_cast<any&>(a)); // expected-note {{requested here}}
 
-    // expected-error@any:* {{static_assert failed "ValueType is required to be a reference or a CopyConstructible type"}}
+    // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
     // expected-error@any:* {{static_cast from 'const no_copy' to 'no_copy' uses deleted function}}
     any_cast<no_copy>(static_cast<any const&>(a)); // expected-note {{requested here}}
 
diff --git a/libcxx/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp b/libcxx/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp
deleted file mode 100644 (file)
index 76df14c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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, c++11, c++14
-
-// <any>
-
-// template <class ValueType>
-// ValueType any_cast(any &&);
-
-// Try and use the rvalue any_cast to cast to an lvalue reference
-
-#include <any>
-
-struct TestType {};
-
-int main()
-{
-    using std::any;
-    using std::any_cast;
-
-    any a;
-    // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
-    // expected-error@any:* {{non-const lvalue reference to type 'TestType' cannot bind to a temporary}}
-    any_cast<TestType &>(std::move(a)); // expected-note {{requested here}}
-
-    // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
-    // expected-error@any:* {{non-const lvalue reference to type 'int' cannot bind to a temporary}}
-    any_cast<int&>(42);
-}
index 4607bb3..ec447b1 100644 (file)
         <tr><td><a href="http://wg21.link/LWG2760">2760</a></td><td>non-const basic_string::data should not invalidate iterators</td><td>Issaquah</td><td>Nothing to do</td></tr>
         <tr><td><a href="http://wg21.link/LWG2765">2765</a></td><td>Did LWG 1123 go too far?</td><td>Issaquah</td><td></td></tr>
         <tr><td><a href="http://wg21.link/LWG2767">2767</a></td><td>not_fn call_wrapper can form invalid types</td><td>Issaquah</td><td></td></tr>
-        <tr><td><a href="http://wg21.link/LWG2768">2768</a></td><td>any_cast and move semantics</td><td>Issaquah</td><td></td></tr>
-<!-- <tr><td><a href="http://wg21.link/LWG2769">2769</a></td><td>Redundant const in the return type of any_cast(const any&)</td><td>Issaquah</td><td></td></tr> -->
+        <tr><td><a href="http://wg21.link/LWG2768">2768</a></td><td>any_cast and move semantics</td><td>Issaquah</td><td>Resolved by LWG 2769</td></tr>
+     <tr><td><a href="http://wg21.link/LWG2769">2769</a></td><td>Redundant const in the return type of any_cast(const any&)</td><td>Issaquah</td><td>Implemented in trunk</td></tr>
         <tr><td><a href="http://wg21.link/LWG2771">2771</a></td><td>Broken Effects of some basic_string::compare functions in terms of basic_string_view</td><td>Issaquah</td><td>We already do this</td></tr>
         <tr><td><a href="http://wg21.link/LWG2773">2773</a></td><td>Making std::ignore constexpr</td><td>Issaquah</td><td></td></tr>
         <tr><td><a href="http://wg21.link/LWG2777">2777</a></td><td>basic_string_view::copy should use char_traits::copy</td><td>Issaquah</td><td>Patch Ready</td></tr>
 <li>2760 - This is just wording cleanup; no code or test changes needed.</li>
 <li>2765 - is this just wording cleanup????? I don't think this actually requires code changes. </li>
 <li>2767 - </li>
-<li>2768 - <i>std::any</i></li>
-<!-- <li>2769 - <i>std::any</i></li> -->
+<li>2768 - <i>std::any</i>: There is no PR for this issue. It is resolved by LWG 2769. </li>
+<li>2769 - <i>std::any</i>: The PR looks good except that
+       <code>remove_reference_t&lt;remove_cv_t&lt;T&gt;&gt;</code> should read
+       <code>remove_cv_t&lt;remove_reference_t&lt;T&gt;&gt;</code>. </li>
 <li>2771 - We already do this.</li>
 <li>2773 - </li>
 <li>2777 - Patch ready; existing tests should suffice</li>