tmp/tmpofqxam4a/{from.md → to.md}
RENAMED
|
@@ -1,41 +1,33 @@
|
|
| 1 |
### [[lex]]: lexical conventions <a id="diff.cpp17.lex">[[diff.cpp17.lex]]</a>
|
| 2 |
|
| 3 |
**Change:** New identifiers with special meaning. **Rationale:**
|
| 4 |
Required for new features. **Effect on original feature:** Logical lines
|
| 5 |
beginning with `module` or `import` may be interpreted differently in
|
| 6 |
-
this
|
| 7 |
-
|
| 8 |
-
[*Example 1*:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
class module {};
|
| 12 |
module m1; // was variable declaration; now module-declaration
|
| 13 |
module *m2; // variable declaration
|
| 14 |
|
| 15 |
class import {};
|
| 16 |
-
import j1; // was variable declaration; now import-declaration
|
| 17 |
::import j2; // variable declaration
|
| 18 |
```
|
| 19 |
|
| 20 |
-
— *end example*]
|
| 21 |
-
|
| 22 |
**Change:** *header-name* tokens are formed in more contexts.
|
| 23 |
**Rationale:** Required for new features. **Effect on original
|
| 24 |
feature:** When the identifier `import` is followed by a `<` character,
|
| 25 |
-
a *header-name* token may be formed.
|
| 26 |
-
|
| 27 |
-
[*Example 2*:
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
template<typename> class import {};
|
| 31 |
import<int> f(); // ill-formed; previously well-formed
|
| 32 |
::import<int> g(); // OK
|
| 33 |
```
|
| 34 |
|
| 35 |
-
— *end example*]
|
| 36 |
-
|
| 37 |
**Change:** New keywords. **Rationale:** Required for new features.
|
| 38 |
|
| 39 |
- The `char8_t` keyword is added to differentiate the types of ordinary
|
| 40 |
and UTF-8 literals [[lex.string]].
|
| 41 |
- The `concept` keyword is added to enable the definition of concepts
|
|
@@ -50,16 +42,17 @@ import<int> f(); // ill-formed; previously well-formed
|
|
| 50 |
*requires-clause* [[temp.pre]] or a *requires-expression*
|
| 51 |
[[expr.prim.req]].
|
| 52 |
|
| 53 |
Valid C++17 code using `char8_t`, `concept`, `consteval`, `constinit`,
|
| 54 |
`co_await`, `co_yield`, `co_return`, or `requires` as an identifier is
|
| 55 |
-
not valid in this
|
| 56 |
|
| 57 |
**Change:** New operator `<=>`. **Rationale:** Necessary for new
|
| 58 |
functionality. **Effect on original feature:** Valid C++17 code that
|
| 59 |
contains a `<=` token immediately followed by a `>` token may be
|
| 60 |
-
ill-formed or have different semantics in this
|
|
|
|
| 61 |
|
| 62 |
``` cpp
|
| 63 |
namespace N {
|
| 64 |
struct X {};
|
| 65 |
bool operator<=(X, X);
|
|
@@ -72,11 +65,11 @@ namespace N {
|
|
| 72 |
Required for new features. The changed types enable function
|
| 73 |
overloading, template specialization, and type deduction to distinguish
|
| 74 |
ordinary and UTF-8 string and character literals. **Effect on original
|
| 75 |
feature:** Valid C++17 code that depends on UTF-8 string literals having
|
| 76 |
type “array of `const char`” and UTF-8 character literals having type
|
| 77 |
-
“`char`” is not valid in this
|
| 78 |
|
| 79 |
``` cpp
|
| 80 |
const auto *u8s = u8"text"; // u8s previously deduced as const char*; now deduced as const char8_t*
|
| 81 |
const char *ps = u8s; // ill-formed; previously well-formed
|
| 82 |
|
|
|
|
| 1 |
### [[lex]]: lexical conventions <a id="diff.cpp17.lex">[[diff.cpp17.lex]]</a>
|
| 2 |
|
| 3 |
**Change:** New identifiers with special meaning. **Rationale:**
|
| 4 |
Required for new features. **Effect on original feature:** Logical lines
|
| 5 |
beginning with `module` or `import` may be interpreted differently in
|
| 6 |
+
this revision of C++. For example:
|
|
|
|
|
|
|
| 7 |
|
| 8 |
``` cpp
|
| 9 |
class module {};
|
| 10 |
module m1; // was variable declaration; now module-declaration
|
| 11 |
module *m2; // variable declaration
|
| 12 |
|
| 13 |
class import {};
|
| 14 |
+
import j1; // was variable declaration; now module-import-declaration
|
| 15 |
::import j2; // variable declaration
|
| 16 |
```
|
| 17 |
|
|
|
|
|
|
|
| 18 |
**Change:** *header-name* tokens are formed in more contexts.
|
| 19 |
**Rationale:** Required for new features. **Effect on original
|
| 20 |
feature:** When the identifier `import` is followed by a `<` character,
|
| 21 |
+
a *header-name* token may be formed. For example:
|
|
|
|
|
|
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
template<typename> class import {};
|
| 25 |
import<int> f(); // ill-formed; previously well-formed
|
| 26 |
::import<int> g(); // OK
|
| 27 |
```
|
| 28 |
|
|
|
|
|
|
|
| 29 |
**Change:** New keywords. **Rationale:** Required for new features.
|
| 30 |
|
| 31 |
- The `char8_t` keyword is added to differentiate the types of ordinary
|
| 32 |
and UTF-8 literals [[lex.string]].
|
| 33 |
- The `concept` keyword is added to enable the definition of concepts
|
|
|
|
| 42 |
*requires-clause* [[temp.pre]] or a *requires-expression*
|
| 43 |
[[expr.prim.req]].
|
| 44 |
|
| 45 |
Valid C++17 code using `char8_t`, `concept`, `consteval`, `constinit`,
|
| 46 |
`co_await`, `co_yield`, `co_return`, or `requires` as an identifier is
|
| 47 |
+
not valid in this revision of C++.
|
| 48 |
|
| 49 |
**Change:** New operator `<=>`. **Rationale:** Necessary for new
|
| 50 |
functionality. **Effect on original feature:** Valid C++17 code that
|
| 51 |
contains a `<=` token immediately followed by a `>` token may be
|
| 52 |
+
ill-formed or have different semantics in this revision of C++. For
|
| 53 |
+
example:
|
| 54 |
|
| 55 |
``` cpp
|
| 56 |
namespace N {
|
| 57 |
struct X {};
|
| 58 |
bool operator<=(X, X);
|
|
|
|
| 65 |
Required for new features. The changed types enable function
|
| 66 |
overloading, template specialization, and type deduction to distinguish
|
| 67 |
ordinary and UTF-8 string and character literals. **Effect on original
|
| 68 |
feature:** Valid C++17 code that depends on UTF-8 string literals having
|
| 69 |
type “array of `const char`” and UTF-8 character literals having type
|
| 70 |
+
“`char`” is not valid in this revision of C++. For example:
|
| 71 |
|
| 72 |
``` cpp
|
| 73 |
const auto *u8s = u8"text"; // u8s previously deduced as const char*; now deduced as const char8_t*
|
| 74 |
const char *ps = u8s; // ill-formed; previously well-formed
|
| 75 |
|