37 lines
1.3 KiB
Markdown
37 lines
1.3 KiB
Markdown
[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 "11 Classes"): 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.10 The 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*]
|