Files
2025-10-25 03:02:53 +03:00

1.3 KiB

[diff.cpp14.class]

Annex C (informative) Compatibility [diff]

C.4 C++ and ISO C++ 2014 [diff.cpp14]

C.4.5 [class]: classes [diff.cpp14.class]

1

#

Affected subclause: [class.inhctor.init]

Change: Inheriting a constructor no longer injects a constructor into the derived class.

Rationale: Better interaction with other language features.

Effect on original feature: Valid C++ 2014 code that uses inheriting constructors may not be valid or may have different semantics.

A using-declaration that names a constructor now makes the corresponding base class constructors visible to initializations of the derived class rather than declaring additional derived class constructors.

[Example 1: struct A {template A(T, typename T::type = 0); A(int);};struct B : A {using A::A; B(int);}; B b(42L); // now calls B(int), used to call B(long),// which called A(int) due to substitution failure// in A(long). — end example]