cplusplus / cplusplus/draft

[meta.trans.other] `common_type` defined by "denotes a valid type" instead of "immediate context is well-formed"

Open
#7,827 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

While trying to fix an issue with some type traits in Clang (llvm/llvm-project#132044), I noticed that std::common_type has notably different language in the standard than other traits that are handled in the same way. The type traits

  • std::is_constructible and variants,
  • std::is_convertible and variants,
  • std::is_assignable and variants,
  • std:reference_{constructs,converts}_from_temporary

are all defined based on some snippet of code being "well-formed", where it is additionally stipulated that "only the validity of the immediate context is considered." (See [meta.unary.prop], [meta.rel].)

However, the corresponding clause for std::common_type in [meta.trans.other] sounds like this:

Otherwise, if decay_t<decltype(false ? declval<D1>() : declval<D2>())> denotes a valid type, let C denote that type.

Why not similar language as for the other type traits? The implementation in Clang seems to apply the same semantics for all these traits.

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.

Research direction

Start by reading the [meta.trans.other], [meta.unary.prop], and [meta.rel] clauses cited in the issue, then review the linked Clang issue llvm/llvm-project#132044. Compare the wording and intended immediate-context semantics for common_type and the other traits. Done means the standard wording question is resolved with an agreed interpretation or wording change.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.