3105. T1 is convertible to T2

Section: 16 [library] Status: New Submitter: Jens Maurer Opened: 2018-04-24 Last modified: 2023-06-25

Priority: 3

View other active issues in [library].

View all other issues in [library].

View all issues with New status.

Discussion:

The library wording frequently uses the construction "type T1 is convertible to type T2", but this is an undefined phrase.

For requirements on user code (e.g. [tuple.rel]), it is unclear whether all expressions of type T1 must satisfy the convertibility requirement, regardless of value category, or whether a single value category is in view only.

Consider:

struct C 
{
  operator int() &&;
};

int main()
{
  int x = C(); // prvalue can be implicitly converted to int
  C c;
  int y = c;   // lvalue can't
}

The library has an "is_convertible<T1, T2>" trait, but that checks convertibility only for a single value category, not all possible ones.

[2018-06-18 after reflector discussion]

Priority set to 3

[2023-06-24; Daniel comments]

This issue has very much overlap with LWG 484.

Proposed resolution: