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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## C++and ISO C++14 <a id="diff.cpp14">[[diff.cpp14]]</a>
|
| 2 |
+
|
| 3 |
+
This subclause lists the differences between C++and ISO C++14(ISO/IEC
|
| 4 |
+
14882:2014, *Programming Languages — C++*), by the chapters of this
|
| 5 |
+
document.
|
| 6 |
+
|
| 7 |
+
### Clause [[lex]]: lexical conventions <a id="diff.cpp14.lex">[[diff.cpp14.lex]]</a>
|
| 8 |
+
|
| 9 |
+
[[lex.phases]] **Change:** Removal of trigraph support as a required
|
| 10 |
+
feature. **Rationale:** Prevents accidental uses of trigraphs in non-raw
|
| 11 |
+
string literals and comments. **Effect on original feature:** Valid
|
| 12 |
+
C++14code that uses trigraphs may not be valid or may have different
|
| 13 |
+
semantics in this International Standard. Implementations may choose to
|
| 14 |
+
translate trigraphs as specified in C++14if they appear outside of a raw
|
| 15 |
+
string literal, as part of the *implementation-defined* mapping from
|
| 16 |
+
physical source file characters to the basic source character set.
|
| 17 |
+
|
| 18 |
+
[[lex.ppnumber]] **Change:** *pp-number* can contain `p` *sign* and `P`
|
| 19 |
+
*sign*. **Rationale:** Necessary to enable hexadecimal floating
|
| 20 |
+
literals. **Effect on original feature:** Valid C++14code may fail to
|
| 21 |
+
compile or produce different results in this International Standard.
|
| 22 |
+
Specifically, character sequences like `0p+0` and `0e1_p+0` are three
|
| 23 |
+
separate tokens each in C++14, but one single token in this
|
| 24 |
+
International Standard.
|
| 25 |
+
|
| 26 |
+
``` cpp
|
| 27 |
+
#define F(a) b ## a
|
| 28 |
+
int b0p = F(0p+0); // ill-formed; equivalent to ``int b0p = b0p + 0;'' in C++14
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
### Clause [[expr]]: expressions <a id="diff.cpp14.expr">[[diff.cpp14.expr]]</a>
|
| 32 |
+
|
| 33 |
+
[[expr.post.incr]], [[expr.pre.incr]] **Change:** Remove increment
|
| 34 |
+
operator with `bool` operand. **Rationale:** Obsolete feature with
|
| 35 |
+
occasionally surprising semantics. **Effect on original feature:** A
|
| 36 |
+
valid C++14expression utilizing the increment operator on a `bool`
|
| 37 |
+
lvalue is ill-formed in this International Standard. Note that this
|
| 38 |
+
might occur when the lvalue has a type given by a template parameter.
|
| 39 |
+
|
| 40 |
+
[[expr.new]], [[expr.delete]] **Change:** Dynamic allocation mechanism
|
| 41 |
+
for over-aligned types. **Rationale:** Simplify use of over-aligned
|
| 42 |
+
types. **Effect on original feature:** In C++14code that uses a
|
| 43 |
+
*new-expression* to allocate an object with an over-aligned class type,
|
| 44 |
+
where that class has no allocation functions of its own,
|
| 45 |
+
`::operator new(std::size_t)` is used to allocate the memory. In this
|
| 46 |
+
International Standard, `::operator new(std::size_t, std::align_val_t)`
|
| 47 |
+
is used instead.
|
| 48 |
+
|
| 49 |
+
### Clause [[dcl.dcl]]: declarations <a id="diff.cpp14.dcl.dcl">[[diff.cpp14.dcl.dcl]]</a>
|
| 50 |
+
|
| 51 |
+
[[dcl.stc]] **Change:** Removal of `register` *storage-class-specifier*.
|
| 52 |
+
**Rationale:** Enable repurposing of deprecated keyword in future
|
| 53 |
+
revisions of this International Standard. **Effect on original
|
| 54 |
+
feature:** A valid C++14declaration utilizing the `register`
|
| 55 |
+
*storage-class-specifier* is ill-formed in this International Standard.
|
| 56 |
+
The specifier can simply be removed to retain the original meaning.
|
| 57 |
+
|
| 58 |
+
[[dcl.spec.auto]] **Change:** `auto` deduction from *braced-init-list*.
|
| 59 |
+
**Rationale:** More intuitive deduction behavior. **Effect on original
|
| 60 |
+
feature:** Valid C++14code may fail to compile or may change meaning in
|
| 61 |
+
this International Standard. For example:
|
| 62 |
+
|
| 63 |
+
``` cpp
|
| 64 |
+
auto x1{1}; // was std::initializer_list<int>, now int
|
| 65 |
+
auto x2{1, 2}; // was std::initializer_list<int>, now ill-formed
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### Clause [[dcl.decl]]: declarators <a id="diff.cpp14.decl">[[diff.cpp14.decl]]</a>
|
| 69 |
+
|
| 70 |
+
[[dcl.fct]] **Change:** Make exception specifications be part of the
|
| 71 |
+
type system. **Rationale:** Improve type-safety. **Effect on original
|
| 72 |
+
feature:** Valid C++14code may fail to compile or change meaning in this
|
| 73 |
+
International Standard:
|
| 74 |
+
|
| 75 |
+
``` cpp
|
| 76 |
+
void g1() noexcept;
|
| 77 |
+
void g2();
|
| 78 |
+
template<class T> int f(T *, T *);
|
| 79 |
+
int x = f(g1, g2); // ill-formed; previously well-formed
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
[[dcl.init.aggr]] **Change:** Definition of an aggregate is extended to
|
| 83 |
+
apply to user-defined types with base classes. **Rationale:** To
|
| 84 |
+
increase convenience of aggregate initialization. **Effect on original
|
| 85 |
+
feature:** Valid C++14code may fail to compile or produce different
|
| 86 |
+
results in this International Standard; initialization from an empty
|
| 87 |
+
initializer list will perform aggregate initialization instead of
|
| 88 |
+
invoking a default constructor for the affected types:
|
| 89 |
+
|
| 90 |
+
``` cpp
|
| 91 |
+
struct derived;
|
| 92 |
+
struct base {
|
| 93 |
+
friend struct derived;
|
| 94 |
+
private:
|
| 95 |
+
base();
|
| 96 |
+
};
|
| 97 |
+
struct derived : base {};
|
| 98 |
+
|
| 99 |
+
derived d1{}; // Error. The code was well-formed before.
|
| 100 |
+
derived d2; // still OK
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### Clause [[special]]: special member functions <a id="diff.cpp14.special">[[diff.cpp14.special]]</a>
|
| 104 |
+
|
| 105 |
+
[[class.inhctor.init]] **Change:** Inheriting a constructor no longer
|
| 106 |
+
injects a constructor into the derived class. **Rationale:** Better
|
| 107 |
+
interaction with other language features. **Effect on original
|
| 108 |
+
feature:** Valid C++14code that uses inheriting constructors may not be
|
| 109 |
+
valid or may have different semantics. A *using-declaration* that names
|
| 110 |
+
a constructor now makes the corresponding base class constructors
|
| 111 |
+
visible to initializations of the derived class rather than declaring
|
| 112 |
+
additional derived class constructors.
|
| 113 |
+
|
| 114 |
+
``` cpp
|
| 115 |
+
struct A {
|
| 116 |
+
template<typename T> A(T, typename T::type = 0);
|
| 117 |
+
A(int);
|
| 118 |
+
};
|
| 119 |
+
struct B : A {
|
| 120 |
+
using A::A;
|
| 121 |
+
B(int);
|
| 122 |
+
};
|
| 123 |
+
B b(42L); // now calls B(int), used to call B<long>(long),
|
| 124 |
+
// which called A(int) due to substitution failure
|
| 125 |
+
// in A<long>(long).
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
### Clause [[temp]]: templates <a id="diff.cpp14.temp">[[diff.cpp14.temp]]</a>
|
| 129 |
+
|
| 130 |
+
[[temp.deduct.type]] **Change:** Allowance to deduce from the type of a
|
| 131 |
+
non-type template argument. **Rationale:** In combination with the
|
| 132 |
+
ability to declare non-type template arguments with placeholder types,
|
| 133 |
+
allows partial specializations to decompose from the type deduced for
|
| 134 |
+
the non-type template argument. **Effect on original feature:** Valid
|
| 135 |
+
C++14code may fail to compile or produce different results in this
|
| 136 |
+
International Standard:
|
| 137 |
+
|
| 138 |
+
``` cpp
|
| 139 |
+
template <int N> struct A;
|
| 140 |
+
template <typename T, T N> int foo(A<N> *) = delete;
|
| 141 |
+
void foo(void *);
|
| 142 |
+
void bar(A<0> *p) {
|
| 143 |
+
foo(p); // ill-formed; previously well-formed
|
| 144 |
+
}
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
### Clause [[except]]: exception handling <a id="diff.cpp14.except">[[diff.cpp14.except]]</a>
|
| 148 |
+
|
| 149 |
+
[[except.spec]] **Change:** Remove dynamic exception specifications.
|
| 150 |
+
**Rationale:** Dynamic exception specifications were a deprecated
|
| 151 |
+
feature that was complex and brittle in use. They interacted badly with
|
| 152 |
+
the type system, which became a more significant issue in this
|
| 153 |
+
International Standard where (non-dynamic) exception specifications are
|
| 154 |
+
part of the function type. **Effect on original feature:** A valid
|
| 155 |
+
C++14function declaration, member function declaration, function pointer
|
| 156 |
+
declaration, or function reference declaration, if it has a potentially
|
| 157 |
+
throwing dynamic exception specification, will be rejected as ill-formed
|
| 158 |
+
in this International Standard. Violating a non-throwing dynamic
|
| 159 |
+
exception specification will call `terminate` rather than `unexpected`
|
| 160 |
+
and might not perform stack unwinding prior to such a call.
|
| 161 |
+
|
| 162 |
+
### Clause [[library]]: library introduction <a id="diff.cpp14.library">[[diff.cpp14.library]]</a>
|
| 163 |
+
|
| 164 |
+
[[namespace.future]] **Change:** New reserved namespaces. **Rationale:**
|
| 165 |
+
Reserve namespaces for future revisions of the standard library that
|
| 166 |
+
might otherwise be incompatible with existing programs. **Effect on
|
| 167 |
+
original feature:** The global namespaces `std` followed by an arbitrary
|
| 168 |
+
sequence of digits is reserved for future standardization. Valid
|
| 169 |
+
C++14code that uses such a top-level namespace, e.g., `std2`, may be
|
| 170 |
+
invalid in this International Standard.
|
| 171 |
+
|
| 172 |
+
### Clause [[utilities]]: general utilities library <a id="diff.cpp14.utilities">[[diff.cpp14.utilities]]</a>
|
| 173 |
+
|
| 174 |
+
[[func.wrap]] **Change:** Constructors taking allocators removed.
|
| 175 |
+
**Rationale:** No implementation consensus. **Effect on original
|
| 176 |
+
feature:** Valid C++14code may fail to compile or may change meaning in
|
| 177 |
+
this International Standard. Specifically, constructing a
|
| 178 |
+
`std::function` with an allocator is ill-formed and uses-allocator
|
| 179 |
+
construction will not pass an allocator to `std::function` constructors
|
| 180 |
+
in this International Standard.
|
| 181 |
+
|
| 182 |
+
[[util.smartptr.shared]] **Change:** Different constraint on conversions
|
| 183 |
+
from `unique_ptr`. **Rationale:** Adding array support to `shared_ptr`,
|
| 184 |
+
via the syntax `shared_ptr<T[]>` and `shared_ptr<T[N]>`. **Effect on
|
| 185 |
+
original feature:** Valid C++14code may fail to compile or may change
|
| 186 |
+
meaning in this International Standard. For example:
|
| 187 |
+
|
| 188 |
+
``` cpp
|
| 189 |
+
#include <memory>
|
| 190 |
+
std::unique_ptr<int[]> arr(new int[1]);
|
| 191 |
+
std::shared_ptr<int> ptr(std::move(arr)); // error: int(*)[] is not compatible with int*
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
### Clause [[strings]]: strings library <a id="diff.cpp14.string">[[diff.cpp14.string]]</a>
|
| 195 |
+
|
| 196 |
+
[[basic.string]] **Change:** Non-const `.data()` member added.
|
| 197 |
+
**Rationale:** The lack of a non-const `.data()` differed from the
|
| 198 |
+
similar member of `std::vector`. This change regularizes behavior for
|
| 199 |
+
this International Standard. **Effect on original feature:** Overloaded
|
| 200 |
+
functions which have differing code paths for `char*` and `const char*`
|
| 201 |
+
arguments will execute differently when called with a non-const string’s
|
| 202 |
+
`.data()` member in this International Standard.
|
| 203 |
+
|
| 204 |
+
``` cpp
|
| 205 |
+
int f(char *) = delete;
|
| 206 |
+
int f(const char *);
|
| 207 |
+
string s;
|
| 208 |
+
int x = f(s.data()); // ill-formed; previously well-formed
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
### Clause [[containers]]: containers library <a id="diff.cpp14.containers">[[diff.cpp14.containers]]</a>
|
| 212 |
+
|
| 213 |
+
[[associative.reqmts]] **Change:** Requirements change: **Rationale:**
|
| 214 |
+
Increase portability, clarification of associative container
|
| 215 |
+
requirements. **Effect on original feature:** Valid C++14code that
|
| 216 |
+
attempts to use associative containers having a comparison object with
|
| 217 |
+
non-const function call operator may fail to compile in this
|
| 218 |
+
International Standard:
|
| 219 |
+
|
| 220 |
+
``` cpp
|
| 221 |
+
#include <set>
|
| 222 |
+
|
| 223 |
+
struct compare
|
| 224 |
+
{
|
| 225 |
+
bool operator()(int a, int b)
|
| 226 |
+
{
|
| 227 |
+
return a < b;
|
| 228 |
+
}
|
| 229 |
+
};
|
| 230 |
+
|
| 231 |
+
int main() {
|
| 232 |
+
const std::set<int, compare> s;
|
| 233 |
+
s.find(0);
|
| 234 |
+
}
|
| 235 |
+
```
|
| 236 |
+
|
| 237 |
+
### Annex [[depr]]: compatibility features <a id="diff.cpp14.depr">[[diff.cpp14.depr]]</a>
|
| 238 |
+
|
| 239 |
+
**Change:** The class templates `auto_ptr`, `unary_function`, and
|
| 240 |
+
`binary_function`, the function templates `random_shuffle`, and the
|
| 241 |
+
function templates (and their return types) `ptr_fun`, `mem_fun`,
|
| 242 |
+
`mem_fun_ref`, `bind1st`, and `bind2nd` are not defined. **Rationale:**
|
| 243 |
+
Superseded by new features. **Effect on original feature:** Valid
|
| 244 |
+
C++14code that uses these class templates and function templates may
|
| 245 |
+
fail to compile in this International Standard.
|
| 246 |
+
|
| 247 |
+
**Change:** Remove old iostreams members \[depr.ios.members\].
|
| 248 |
+
**Rationale:** Redundant feature for compatibility with pre-standard
|
| 249 |
+
code has served its time. **Effect on original feature:** A valid
|
| 250 |
+
C++14program using these identifiers may be ill-formed in this
|
| 251 |
+
International Standard.
|
| 252 |
+
|