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

37 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[diff.cpp14.class]
# Annex C (informative) Compatibility [[diff]](./#diff)
## C.4 C++ and ISO C++ 2014 [[diff.cpp14]](diff.cpp14#class)
### C.4.5 [[class]](class "11Classes"): classes [diff.cpp14.class]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L1735)
**Affected subclause:** [[class.inhctor.init]](class.inhctor.init)
**Change:** Inheriting a constructor no longer injects a constructor into the derived class[.](#1.sentence-1)
**Rationale:** Better interaction with other language features[.](#1.sentence-2)
**Effect on original feature:** Valid C++ 2014 code that uses inheriting constructors may not be valid
or may have different semantics[.](#1.sentence-3)
A [*using-declaration*](namespace.udecl#nt:using-declaration "9.10The using declaration[namespace.udecl]") 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[.](#1.sentence-4)
[*Example [1](#example-1)*: struct A {template<typename T> 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>(long),// which called A(int) due to substitution failure// in A<long>(long). — *end example*]