-
Notifications
You must be signed in to change notification settings - Fork 790
Description
In N4778 [meta.logical]/2
then instantiating
conjunction<B1, ..., BN>::value
does not require the instantiation ofBj::value
forj > i
What is "the instantiation of Bj::value
"?
(The font of j
should also be fixed.)
The change in #1133 (LWG 2567) also introduces another (possibly non-editorial) problem: does the explicit cast to bool
of value
mandated? For example:
#include <type_traits>
struct B
{
constexpr explicit operator bool() const noexcept {return true;}
};
struct C
{
static constexpr const B value = B();
};
int main()
{
static_assert(bool(std::conjunction<C, std::true_type>::value));
}
Is the program above well-formed?
It seems intentionally ill-formed as per "shall have a member value
which is convertible to bool
" wording in [meta.logical]/4. (Is this presumely "implicit", or like std::is_convertible
?) Then bool(Bj::value)
is not appropriate as it suggests the cast shall be supported, as implemented in cppreference.
Otherwise, libstdc++, libc++ and MSVC currently all has the bug concerned with the resolution of LWG 2567, and [meta.logical]/4 should be reworded to clarify the intention. I guess this is not intentional because a) it was not proposed, which should be consisted to existed implementations; b) the context here is more like operands of &&
but not if
, which needs no contextually conversion, so omission of explicit cast should not be encouraged; and c) it is an editorial side effect implied by the title of #1133: "fixed in add further explicit boolean conversions editorially".