cplusplus / cplusplus/draft

[meta.logical] unclear wording

Open
#2,548 7 comments 0 reactions 1 assignee View on GitHub

@jwakely is already working on this.

Since Dec 19, 2018.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

In N4778 [meta.logical]/2

then instantiating conjunction<B1, ..., BN>::value does not require the instantiation of Bj::value for j > 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".

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.