Created on 2014-10-07.00:00:00 last changed 14 months ago
Rationale (September, 2023):
This issue is a duplicate of issue 2352.
Qualification conversions are not considered when doing reference binding, which leads to some unexpected results:
template<typename T> T make(); struct B {}; struct D : B {}; const int *p1 = make<int*>(); // ok, qualification conversion const int *const *p2 = make<int**>(); // ok, qualification conversion const int **p3 = make<int**>(); // error, not type safe const int &r1 = make<int&>(); // ok, binds directly const int *const &r2 = make<int*&>(); // weird, binds to a temporary const int *&r3 = make<int*&>(); // error const int &&x1 = make<int&&>(); // ok, binds directly const int *const &&x2 = make<int*&&>(); // weird, binds to a temporary const int *&&x3 = make<int*&&>(); // weird, binds to a temporary
It might make sense to say that similar types are reference-related and if there is a qualification conversion they are reference-compatible.
See also issue 2023.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-09-16 06:41:53 | admin | set | messages: + msg7435 |
2023-09-16 06:41:53 | admin | set | status: drafting -> dup |
2015-05-25 00:00:00 | admin | set | status: open -> drafting |
2014-10-07 00:00:00 | admin | create |