SFINAE and inherited constructor default arguments
_N4527_.12.9 [class.inhctor]
David Krauss

Created on 2014-06-12.00:00:00 last changed 49 months ago


Date: 2015-10-15.00:00:00

[Adopted at the October, 2015 meeting as P0136R1.]

Default arguments are a common mechanism for applying SFINAE to constructors. However, default arguments are not carried over when base class constructors are inherited; instead, an overload set of constructors with various numbers of arguments is created in the derived class. This seems problematic.

One possibility would be to change the mechanism for how constructors are inherited; a using-declaration might actually introduce the base class constructors into the derived class, as other using-declarations do, and if a base class constructor were selected, the remaining derived class members would be default-initialized.

This approach would also address issues 1645, as duplicated constructors would simply fail during overload resolution, and 1715, since there would be no synthesized constructors for which access checking would be needed.

The effect of such an approach on ABIs, including mangling, would need to be considered.

See also issue 1959.

Date User Action Args
2017-02-06 00:00:00adminsetstatus: dr -> cd4
2015-11-10 00:00:00adminsetstatus: drafting -> dr
2014-06-12 00:00:00admincreate