Created on 2014-06-30.00:00:00 last changed 95 months ago
[Adopted at the October, 2015 meeting as P0136R1.]
Consider the following example:
struct a { a() = default; a( a const & ) { std::cout << "copy\n"; } template< typename t > a( t ) { std::cout << "convert\n"; } }; struct b : a { using a::a; }; a x; b y = x;
The copy constructor is invoked by the inherited constructor template, making it effectively inherited, contrary to the intent of _N4527_.12.9 [class.inhctor] paragraph 3. std::function is affected by this issue.
A kernel of a resolution might be to inherit the copy and move constructors as deleted. Then they will be more specialized than any template, and the user won't get conversion-from-base behavior unless they explicitly declare it. However, reference binding in overload resolution is a potential gap. Something like b::b( a & ) = delete with a non-const parameter would not add safety if it's not chosen.
See also issue 1941.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: dr -> cd4 |
2015-11-10 00:00:00 | admin | set | status: drafting -> dr |
2014-06-30 00:00:00 | admin | create |