From Jason Turner

[diff.cpp14.class]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpijz1gvi3/{from.md → to.md} +25 -0
tmp/tmpijz1gvi3/{from.md → to.md} RENAMED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### [[class]]: classes <a id="diff.cpp14.class">[[diff.cpp14.class]]</a>
2
+
3
+ **Change:** Inheriting a constructor no longer injects a constructor
4
+ into the derived class. **Rationale:** Better interaction with other
5
+ language features. **Effect on original feature:** Valid C++14 code that
6
+ uses inheriting constructors may not be valid or may have different
7
+ semantics. A *using-declaration* that names a constructor now makes the
8
+ corresponding base class constructors visible to initializations of the
9
+ derived class rather than declaring additional derived class
10
+ constructors.
11
+
12
+ ``` cpp
13
+ struct A {
14
+ template<typename T> A(T, typename T::type = 0);
15
+ A(int);
16
+ };
17
+ struct B : A {
18
+ using A::A;
19
+ B(int);
20
+ };
21
+ B b(42L); // now calls B(int), used to call B<long>(long),
22
+ // which called A(int) due to substitution failure
23
+ // in A<long>(long).
24
+ ```
25
+