Re: [libcxx] r299734 - Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.

2017-04-07 Thread Akira Hatanaka via cfe-commits
I reverted r299734 in r299744. Feel free to recommit it once the test is fixed.

> On Apr 6, 2017, at 10:36 PM, Akira Hatanaka via cfe-commits 
>  wrote:
> 
> It looks like this commit and r299735 are causing bots to fail:
> 
> http://green.lab.llvm.org/green/job/libcxx_master_cmake_32/66/ 
> 
> 
> The test hash_unique_ptr.pass.cpp doesn’t compile when -std=c++03 is on the 
> command line because PointerDeleter defined in deleter_types.h is guarded 
> with "TEST_STD_VER >= 11”.
> 
>> On Apr 6, 2017, at 4:50 PM, Billy Robert O'Neal III via cfe-commits 
>> > wrote:
>> 
>> Author: bion
>> Date: Thu Apr  6 18:50:21 2017
>> New Revision: 299734
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=299734=rev 
>> 
>> Log:
>> Allow a standard library to implement conditional noexcept for optional and 
>> unique_ptr hash functions.
>> 
>> These tests were unconditionally asserting that optional and unique_ptr 
>> declare throwing hashes, but MSVC++ implements conditional noexcept 
>> forwarding that of the underlying hash function. As a result we were failing 
>> these tests but there's nothing forbidding strengthening noexcept in that 
>> way.
>> 
>> Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have 
>> non-noexcept hash functions.
>> 
>> Modified:
>>
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
>>libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp
>> 
>> Modified: 
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp?rev=299734=299733=299734=diff
>>  
>> 
>> ==
>> --- 
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
>>  (original)
>> +++ 
>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
>>  Thu Apr  6 18:50:21 2017
>> @@ -67,10 +67,14 @@ int main()
>> int* ptr = new int;
>> std::unique_ptr p(ptr);
>> std::hash f;
>> -ASSERT_NOT_NOEXCEPT(f(p));
>> std::size_t h = f(p);
>> assert(h == std::hash()(ptr));
>>   }
>> +  {
>> +std::unique_ptr> pThrowingHash;
>> +std::hash>> fThrowingHash;
>> +ASSERT_NOT_NOEXCEPT(fThrowingHash(pThrowingHash));
>> +  }
>> #if TEST_STD_VER >= 11
>>   {
>> test_enabled_with_deleter();
>> 
>> Modified: 
>> libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp?rev=299734=299733=299734=diff
>>  
>> 
>> ==
>> --- libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp 
>> (original)
>> +++ libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Thu 
>> Apr  6 18:50:21 2017
>> @@ -38,9 +38,14 @@ int main()
>> std::hash{}(optional{});
>> 
>> {
>> +optional opt;
>> +ASSERT_NOT_NOEXCEPT(std::hash()(opt));
>> +ASSERT_NOT_NOEXCEPT(std::hash()(opt));
>> +}
>> +
>> +{
>> typedef int T;
>> optional opt;
>> -ASSERT_NOT_NOEXCEPT(std::hash()(opt));
>> assert(std::hash{}(opt) == nullopt_hash);
>> opt = 2;
>> assert(std::hash{}(opt) == std::hash{}(*opt));
>> @@ -48,7 +53,6 @@ int main()
>> {
>> typedef std::string T;
>> optional opt;
>> -ASSERT_NOT_NOEXCEPT(std::hash()(opt));
>> assert(std::hash{}(opt) == nullopt_hash);
>> opt = std::string("123");
>> assert(std::hash{}(opt) == std::hash{}(*opt));
>> @@ -56,7 +60,6 @@ int main()
>> {
>> typedef std::unique_ptr T;
>> optional opt;
>> -ASSERT_NOT_NOEXCEPT(std::hash()(opt));
>> assert(std::hash{}(opt) == nullopt_hash);
>> opt = std::unique_ptr(new int(3));
>> assert(std::hash{}(opt) == std::hash{}(*opt));
>> 
>> 
>> ___
>> cfe-commits mailing list
>> 

Re: [libcxx] r299734 - Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.

2017-04-06 Thread Akira Hatanaka via cfe-commits
It looks like this commit and r299735 are causing bots to fail:

http://green.lab.llvm.org/green/job/libcxx_master_cmake_32/66/ 


The test hash_unique_ptr.pass.cpp doesn’t compile when -std=c++03 is on the 
command line because PointerDeleter defined in deleter_types.h is guarded with 
"TEST_STD_VER >= 11”.

> On Apr 6, 2017, at 4:50 PM, Billy Robert O'Neal III via cfe-commits 
>  wrote:
> 
> Author: bion
> Date: Thu Apr  6 18:50:21 2017
> New Revision: 299734
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=299734=rev
> Log:
> Allow a standard library to implement conditional noexcept for optional and 
> unique_ptr hash functions.
> 
> These tests were unconditionally asserting that optional and unique_ptr 
> declare throwing hashes, but MSVC++ implements conditional noexcept 
> forwarding that of the underlying hash function. As a result we were failing 
> these tests but there's nothing forbidding strengthening noexcept in that way.
> 
> Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have 
> non-noexcept hash functions.
> 
> Modified:
>
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
>libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp
> 
> Modified: 
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp?rev=299734=299733=299734=diff
> ==
> --- 
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
>  (original)
> +++ 
> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
>  Thu Apr  6 18:50:21 2017
> @@ -67,10 +67,14 @@ int main()
> int* ptr = new int;
> std::unique_ptr p(ptr);
> std::hash f;
> -ASSERT_NOT_NOEXCEPT(f(p));
> std::size_t h = f(p);
> assert(h == std::hash()(ptr));
>   }
> +  {
> +std::unique_ptr> pThrowingHash;
> +std::hash>> fThrowingHash;
> +ASSERT_NOT_NOEXCEPT(fThrowingHash(pThrowingHash));
> +  }
> #if TEST_STD_VER >= 11
>   {
> test_enabled_with_deleter();
> 
> Modified: libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp?rev=299734=299733=299734=diff
> ==
> --- libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp 
> (original)
> +++ libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Thu 
> Apr  6 18:50:21 2017
> @@ -38,9 +38,14 @@ int main()
> std::hash{}(optional{});
> 
> {
> +optional opt;
> +ASSERT_NOT_NOEXCEPT(std::hash()(opt));
> +ASSERT_NOT_NOEXCEPT(std::hash()(opt));
> +}
> +
> +{
> typedef int T;
> optional opt;
> -ASSERT_NOT_NOEXCEPT(std::hash()(opt));
> assert(std::hash{}(opt) == nullopt_hash);
> opt = 2;
> assert(std::hash{}(opt) == std::hash{}(*opt));
> @@ -48,7 +53,6 @@ int main()
> {
> typedef std::string T;
> optional opt;
> -ASSERT_NOT_NOEXCEPT(std::hash()(opt));
> assert(std::hash{}(opt) == nullopt_hash);
> opt = std::string("123");
> assert(std::hash{}(opt) == std::hash{}(*opt));
> @@ -56,7 +60,6 @@ int main()
> {
> typedef std::unique_ptr T;
> optional opt;
> -ASSERT_NOT_NOEXCEPT(std::hash()(opt));
> assert(std::hash{}(opt) == nullopt_hash);
> opt = std::unique_ptr(new int(3));
> assert(std::hash{}(opt) == std::hash{}(*opt));
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r299734 - Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.

2017-04-06 Thread Billy Robert O'Neal III via cfe-commits
Author: bion
Date: Thu Apr  6 18:50:21 2017
New Revision: 299734

URL: http://llvm.org/viewvc/llvm-project?rev=299734=rev
Log:
Allow a standard library to implement conditional noexcept for optional and 
unique_ptr hash functions.

These tests were unconditionally asserting that optional and unique_ptr declare 
throwing hashes, but MSVC++ implements conditional noexcept forwarding that of 
the underlying hash function. As a result we were failing these tests but 
there's nothing forbidding strengthening noexcept in that way.

Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have 
non-noexcept hash functions.

Modified:

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp?rev=299734=299733=299734=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
 Thu Apr  6 18:50:21 2017
@@ -67,10 +67,14 @@ int main()
 int* ptr = new int;
 std::unique_ptr p(ptr);
 std::hash f;
-ASSERT_NOT_NOEXCEPT(f(p));
 std::size_t h = f(p);
 assert(h == std::hash()(ptr));
   }
+  {
+std::unique_ptr> pThrowingHash;
+std::hash>> fThrowingHash;
+ASSERT_NOT_NOEXCEPT(fThrowingHash(pThrowingHash));
+  }
 #if TEST_STD_VER >= 11
   {
 test_enabled_with_deleter();

Modified: libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp?rev=299734=299733=299734=diff
==
--- libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Thu 
Apr  6 18:50:21 2017
@@ -38,9 +38,14 @@ int main()
 std::hash{}(optional{});
 
 {
+optional opt;
+ASSERT_NOT_NOEXCEPT(std::hash()(opt));
+ASSERT_NOT_NOEXCEPT(std::hash()(opt));
+}
+
+{
 typedef int T;
 optional opt;
-ASSERT_NOT_NOEXCEPT(std::hash()(opt));
 assert(std::hash{}(opt) == nullopt_hash);
 opt = 2;
 assert(std::hash{}(opt) == std::hash{}(*opt));
@@ -48,7 +53,6 @@ int main()
 {
 typedef std::string T;
 optional opt;
-ASSERT_NOT_NOEXCEPT(std::hash()(opt));
 assert(std::hash{}(opt) == nullopt_hash);
 opt = std::string("123");
 assert(std::hash{}(opt) == std::hash{}(*opt));
@@ -56,7 +60,6 @@ int main()
 {
 typedef std::unique_ptr T;
 optional opt;
-ASSERT_NOT_NOEXCEPT(std::hash()(opt));
 assert(std::hash{}(opt) == nullopt_hash);
 opt = std::unique_ptr(new int(3));
 assert(std::hash{}(opt) == std::hash{}(*opt));


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits