[libcxx-commits] [PATCH] D91986: [libc++] Implements concept constructible_from

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 24 09:57:14 PST 2020


cjdb added a comment.

In D91986#2414199 <https://reviews.llvm.org/D91986#2414199>, @Mordante wrote:

> In D91986#2412189 <https://reviews.llvm.org/D91986#2412189>, @cjdb wrote:
>
>> @CaseyCarter had this to say back in D74291 <https://reviews.llvm.org/D74291>.
>>
>>> There's tons of coverage here for class types and reference types. What about `void`, function types, pointers, arrays, pointers-to-members? (I don't know about clang/libc++, but the MSVC STL tests for type traits tend to _be_ the tests for compiler intrinsics used to implement those traits, so we consequently cover everything under the sun.)
>>
>> I'd suggest we apply this here as well.
>
> Thanks for the suggestion and I will keep that in mind for other tests. However since this concept is fully specified by the Standard http://eel.is/c++draft/concept.constructible. I prefer to take the approach as suggested in D91004 <https://reviews.llvm.org/D91004>
>
>> @ldionne 
>> In general, when writing tests for libc++, one should not assume knowledge of implementation-specific details for the following reasons:
>>
>> 1. The implementation may change in the future, and the tests should still provide us with sufficient confidence in that event.
>> 2. Other standard libraries use our tests, and we can't assume they are implemented the same way.
>>
>> *However*, this is not implementation-specific in this case, because the Standard (http://eel.is/c++draft/concept.destructible#lib:destructible) specifies that `destructible` is defined exactly as `is_­nothrow_­destructible_­v<T>`. It doesn't say "equivalent to `is_­nothrow_­destructible_­v<T>`" or something like that. I think the best way of testing that would be to throw a bunch of different types and say `static_assert(std::destructible<T> == std::is_­nothrow_­destructible_­v<T>)`.

@ldionne's comment isn't at odds with @CaseyCarter's. If anything, it's complementing it: `void`, function types, arrays, and pointer-to-members are all different types, none of which are being tested right now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91986/new/

https://reviews.llvm.org/D91986



More information about the libcxx-commits mailing list