Author: ericwf Date: Sat Oct 15 20:43:43 2016 New Revision: 284321 URL: http://llvm.org/viewvc/llvm-project?rev=284321&view=rev Log: Update issue status for LWG 2768 and 2769
Added: libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp Removed: libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp Modified: libcxx/trunk/include/any libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp libcxx/trunk/www/upcoming_meeting.html Modified: libcxx/trunk/include/any URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/any?rev=284321&r1=284320&r2=284321&view=diff ============================================================================== --- libcxx/trunk/include/any (original) +++ libcxx/trunk/include/any Sat Oct 15 20:43:43 2016 @@ -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(); Added: libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp?rev=284321&view=auto ============================================================================== --- libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp (added) +++ libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp Sat Oct 15 20:43:43 2016 @@ -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(); +} Modified: libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp?rev=284321&r1=284320&r2=284321&view=diff ============================================================================== --- libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp (original) +++ libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp Sat Oct 15 20:43:43 2016 @@ -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}} } Modified: libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp?rev=284321&r1=284320&r2=284321&view=diff ============================================================================== --- libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp (original) +++ libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp Sat Oct 15 20:43:43 2016 @@ -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}} Removed: libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp?rev=284320&view=auto ============================================================================== --- libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp (original) +++ libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp (removed) @@ -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); -} Modified: libcxx/trunk/www/upcoming_meeting.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284321&r1=284320&r2=284321&view=diff ============================================================================== --- libcxx/trunk/www/upcoming_meeting.html (original) +++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 20:43:43 2016 @@ -127,8 +127,8 @@ <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> @@ -205,8 +205,10 @@ <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<remove_cv_t<T>></code> should read + <code>remove_cv_t<remove_reference_t<T>></code>. </li> <li>2771 - We already do this.</li> <li>2773 - </li> <li>2777 - Patch ready; existing tests should suffice</li> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits