|
39 | 39 | auto c = L"a" U"b"; // was conditionally-supported; now ill-formed |
40 | 40 | \end{codeblock} |
41 | 41 |
|
42 | | -\rSec2[diff.cpp20.dcl]{\ref{dcl.dcl}: declarations} |
43 | | - |
44 | | -\diffref{dcl.init.string} |
45 | | -\change |
46 | | -UTF-8 string literals may initialize arrays of \keyword{char} or |
47 | | -\tcode{\keyword{unsigned} \keyword{char}}. |
48 | | -\rationale |
49 | | -Compatibility with previously written code that conformed to previous versions of this document. |
50 | | -\effect |
51 | | -Arrays of \keyword{char} or \tcode{\keyword{unsigned} \keyword{char}} |
52 | | -may now be initialized with a UTF-8 string literal. |
53 | | -This can affect initialization that includes arrays |
54 | | -that are directly initialized within class types, typically aggregates. |
55 | | -For example: |
56 | | -\begin{codeblock} |
57 | | -struct A { |
58 | | - char8_t s[10]; |
59 | | -}; |
60 | | -struct B { |
61 | | - char s[10]; |
62 | | -}; |
63 | | - |
64 | | -void f(A); |
65 | | -void f(B); |
66 | | - |
67 | | -int main() { |
68 | | - f({u8""}); // ambiguous |
69 | | -} |
70 | | -\end{codeblock} |
71 | | - |
72 | 42 | \rSec2[diff.cpp20.expr]{\ref{expr}: expressions} |
73 | 43 |
|
74 | 44 | \diffref{expr.prim.id.unqual} |
|
99 | 69 | // now equivalent to \tcode{arr.operator[](1, 2)} or ill-formed |
100 | 70 | \end{codeblock} |
101 | 71 |
|
| 72 | +\rSec2[diff.cpp20.dcl]{\ref{dcl.dcl}: declarations} |
| 73 | + |
| 74 | +\diffref{dcl.init.string} |
| 75 | +\change |
| 76 | +UTF-8 string literals may initialize arrays of \keyword{char} or |
| 77 | +\tcode{\keyword{unsigned} \keyword{char}}. |
| 78 | +\rationale |
| 79 | +Compatibility with previously written code that conformed to previous versions of this document. |
| 80 | +\effect |
| 81 | +Arrays of \keyword{char} or \tcode{\keyword{unsigned} \keyword{char}} |
| 82 | +may now be initialized with a UTF-8 string literal. |
| 83 | +This can affect initialization that includes arrays |
| 84 | +that are directly initialized within class types, typically aggregates. |
| 85 | +For example: |
| 86 | +\begin{codeblock} |
| 87 | +struct A { |
| 88 | + char8_t s[10]; |
| 89 | +}; |
| 90 | +struct B { |
| 91 | + char s[10]; |
| 92 | +}; |
| 93 | + |
| 94 | +void f(A); |
| 95 | +void f(B); |
| 96 | + |
| 97 | +int main() { |
| 98 | + f({u8""}); // ambiguous |
| 99 | +} |
| 100 | +\end{codeblock} |
| 101 | + |
102 | 102 | \rSec2[diff.cpp20.temp]{\ref{temp}: templates} |
103 | 103 |
|
104 | 104 | \diffref{temp.deduct.type} |
|
0 commit comments