|
19 | 19 | \pnum |
20 | 20 | \begin{example} |
21 | 21 | \begin{codeblock} |
22 | | -int _z; // No diagnostic required, \_z is reserved because it starts with \_ at global scope |
| 22 | +int _z; // no diagnostic required, \tcode{\_z} is reserved because it starts with \tcode{\_} at global scope |
23 | 23 |
|
24 | 24 | int main() { |
25 | | - int __x; // No diagnostic required, \_\_x is reserved because it starts with \_\_ |
26 | | - int _Y; // No diagnostic required, \_Y is reserved because it starts with \_ followed by a capital letter |
27 | | - int x__y; // No diagnostic required, x\_\_y is reserved because it contains \_\_ |
| 25 | + int __x; // no diagnostic required, \tcode{\_\_x} is reserved because it starts with \tcode{\_\_} |
| 26 | + int _Y; // no diagnostic required, \tcode{\_Y} is reserved because it starts with \tcode{\_} followed by a capital letter |
| 27 | + int x__y; // no diagnostic required, \tcode{x\_\_y} is reserved because it contains \tcode{\_\_} |
28 | 28 | } |
29 | 29 | \end{codeblock} |
30 | 30 | \end{example} |
|
47 | 47 | return A{}; |
48 | 48 | } |
49 | 49 | decltype(f()) g(); |
50 | | -auto x = g(); // Ill-formed, no diagnostic required, function g is used but not defined |
51 | | - // in this translation unit, and cannot be defined in any other translation unit |
52 | | - // because its type does not have linkage |
| 50 | +auto x = g(); // ill-formed, no diagnostic required, function \tcode{g} is used but not defined |
| 51 | + // in this translation unit, and cannot be defined in any other translation unit |
| 52 | + // because its type does not have linkage |
53 | 53 | \end{codeblock} |
54 | 54 | \end{example} |
55 | 55 |
|
|
73 | 73 | // main.cpp |
74 | 74 | import "a.h"; |
75 | 75 | import "b.h"; |
76 | | -auto n = decltype(a)::b; // Ill-formed no diagnostic required, more than one unnammed enum |
77 | | - // definition reachable at this point but their types are not the same |
| 76 | +auto n = decltype(a)::b; // ill-formed no diagnostic required, more than one unnammed enum |
| 77 | + // definition reachable at this point but their types are not the same |
78 | 78 | \end{codeblock} |
79 | 79 | \end{example} |
80 | 80 |
|
|
166 | 166 | int main() { |
167 | 167 | using T = const int; |
168 | 168 | T(x) |
169 | | - (100), (y)(A<x>::a); // Ill-formed no diagnostic required, during trial parse the template |
170 | | - // parameter x is bound to the global x later during parsing the template |
171 | | - // parameter x is bound to the local x declared on the same line |
| 169 | + (100), (y)(A<x>::a); // ill-formed no diagnostic required, during trial parse the template |
| 170 | + // parameter \tcode{x} is bound to the global \tcode{x} later during parsing the template |
| 171 | + // parameter \tcode{x} is bound to the local \tcode{x} declared on the same line |
172 | 172 | } |
173 | 173 | \end{codeblock} |
174 | 174 | \end{example} |
|
190 | 190 | struct S { int x; } s, *p = &s; |
191 | 191 |
|
192 | 192 | // Translation unit \#2: |
193 | | -struct alignas(16) S; // ill-formed, no diagnostic required: definition of S lacks alignment |
| 193 | +struct alignas(16) S; // ill-formed, no diagnostic required, definition of \tcode{S} lacks alignment |
194 | 194 | extern S* p; |
195 | 195 | \end{codeblock} |
196 | 196 | \end{example} |
|
208 | 208 | } |
209 | 209 |
|
210 | 210 | /* Translation Unit B */ |
211 | | -struct void f(int i); // Ill-formed no diagnostic required, declared without noreturn |
| 211 | +struct void f(int i); // ill-formed no diagnostic required, declared without noreturn |
212 | 212 | \end{codeblock} |
213 | 213 | \end{example} |
214 | 214 |
|
|
225 | 225 | \pnum |
226 | 226 | \begin{example} |
227 | 227 | \begin{codeblock} |
228 | | -module std; // Ill-formed no diagnostic required, std is not allowed at the beginning |
229 | | -module module; // Ill-formed no diagnostic required, module is a reserved identifier |
230 | | -module std0; // Ill-formed no diagnostic required, std followed by digits is not allowed at the beginning |
231 | | -export module _Test; // Ill-formed no diagnostic required, _Test is a reserved identifier |
232 | | -export module te__st; // Ill-formed no diagnostic required, te__st is a reserved identifier |
| 228 | +module std; // ill-formed no diagnostic required, \tcode{std} is not allowed at the beginning |
| 229 | +module module; // ill-formed no diagnostic required, \tcode{module} is a reserved identifier |
| 230 | +module std0; // ill-formed no diagnostic required, \tcode{std} followed by digits is not allowed at the beginning |
| 231 | +export module _Test; // ill-formed no diagnostic required, \tcode{_Test} is a reserved identifier |
| 232 | +export module te__st; // ill-formed no diagnostic required, \tcode{te__st} is a reserved identifier |
233 | 233 | \end{codeblock} |
234 | 234 | \end{example} |
235 | 235 |
|
|
244 | 244 | \begin{example} |
245 | 245 | \begin{codeblock} |
246 | 246 | module A; |
247 | | -export import :Internals; // Ill-formed no diagnostic required, module parition not allowed |
| 247 | +export import :Internals; // ill-formed no diagnostic required, module partition not allowed |
248 | 248 | \end{codeblock} |
249 | 249 | \end{example} |
250 | 250 |
|
|
262 | 262 | \begin{example} |
263 | 263 | \begin{codeblock} |
264 | 264 | struct C { |
265 | | - C( int ) { } // \#1: non-delegating constructor |
266 | | - C(): C(42) { } // \#2: delegates to \#1 |
267 | | - C( char c ) : C(42.0) { } // \#3: ill-formed no diagnostic required due to recursion with \#4 |
268 | | - C( double d ) : C('a') { } // \#4: ill-formed no diagnostic required due to recursion with \#3 |
| 265 | + C( int ) { } // \#1: non-delegating constructor |
| 266 | + C(): C(42) { } // \#2: delegates to \#1 |
| 267 | + C( char c ) : C(42.0) { } // \#3: ill-formed no diagnostic required due to recursion with \#4 |
| 268 | + C( double d ) : C('a') { } // \#4: ill-formed no diagnostic required due to recursion with \#3 |
269 | 269 | }; |
270 | 270 | \end{codeblock} |
271 | 271 | \end{example} |
|
286 | 286 | }; |
287 | 287 |
|
288 | 288 | int main() { |
289 | | - A a; // Ill-formed no diagnostic required, virtual function that is not pure but has not definition |
| 289 | + A a; // ill-formed no diagnostic required, virtual function that is not pure but has not definition |
290 | 290 | } |
291 | 291 | \end{codeblock} |
292 | 292 | \end{example} |
|
305 | 305 | \pnum |
306 | 306 | \begin{example} |
307 | 307 | \begin{codeblock} |
308 | | -float operator ""E(const char*); // ill-formed, no diagnostic required: |
309 | | - // reserved literal suffix |
310 | | -double operator"" _Bq(long double); // ill-formed, no diagnostic required: |
311 | | - // uses the reserved identifier _Bq |
| 308 | +float operator ""E(const char*); // ill-formed, no diagnostic required, reserved literal suffix |
| 309 | +double operator"" _Bq(long double); // ill-formed, no diagnostic required, // uses the reserved identifier \tcode{_Bq} |
312 | 310 | \end{codeblock} |
313 | 311 | \end{example} |
314 | 312 |
|
|
333 | 331 | // a.cpp |
334 | 332 | #include "a.h" |
335 | 333 | int main() { |
336 | | - f<int>(); // Ill-formed no diagnostic required, function template implicity |
337 | | - // instantiated but not reachable definition |
| 334 | + f<int>(); // ill-formed no diagnostic required, function template implicity |
| 335 | + // instantiated but not reachable definition |
338 | 336 | } |
339 | 337 | \end{codeblock} |
340 | 338 | \end{example} |
|
388 | 386 | template <unsigned N> int f2() |
389 | 387 | requires Add1<N * 2> && true; |
390 | 388 | void h2() { |
391 | | -f2<0>(); // ill-formed, no diagnostic required: |
392 | | - // requires determination of subsumption between atomic constraints that are |
393 | | - // functionally equivalent but not equivalent |
| 389 | +f2<0>(); // ill-formed, no diagnostic required, |
| 390 | + // requires determination of subsumption between atomic constraints that are |
| 391 | + // functionally equivalent but not equivalent |
394 | 392 | \end{codeblock} |
395 | 393 | \end{example} |
396 | 394 |
|
|
405 | 403 | concept Complete = sizeof(T) == sizeof(T); |
406 | 404 |
|
407 | 405 | struct A; |
408 | | -static_assert(!Complete<A>); // 1 |
| 406 | +static_assert(!Complete<A>); // \#1 |
409 | 407 | struct A {}; |
410 | | -static_assert(Complete<A>); // Ill-formed no diagnostic required, satisfaction |
411 | | - // result differs from point 1 |
| 408 | +static_assert(Complete<A>); // ill-formed no diagnostic required, satisfaction |
| 409 | + // result differs from point \#1 |
412 | 410 | \end{codeblock} |
413 | 411 | \end{example} |
414 | 412 |
|
|
446 | 444 | void foo(){}; |
447 | 445 | }; |
448 | 446 |
|
449 | | -template class X<void *>; // Ill-formed no diagnostic required, explicit instantiation |
450 | | - // and partial specialization is not reachable |
| 447 | +template class X<void *>; // ill-formed no diagnostic required, explicit instantiation |
| 448 | + // and partial specialization is not reachable |
451 | 449 |
|
452 | 450 | template<typename T> class X<T*>{ |
453 | 451 | public: |
|
474 | 472 | Ptr<int> p; // error: constraints not satisfied |
475 | 473 |
|
476 | 474 | template<typename T> |
477 | | -struct S2 { Ptr<int> x; }; // ill-formed, no diagnostic required |
| 475 | +struct S2 { Ptr<int> x; }; // ill-formed, no diagnostic required |
478 | 476 | \end{codeblock} |
479 | 477 | \end{example} |
480 | 478 |
|
|
569 | 567 | extern template class std::vector<int>; |
570 | 568 |
|
571 | 569 | int main() { |
572 | | - std::cout << std::vector<int>().size(); // Ill-formed no diagnostic required, implicit instantiation |
573 | | - // but no explicit instantiation definition |
| 570 | + std::cout << std::vector<int>().size(); // ill-formed no diagnostic required, implicit instantiation |
| 571 | + // but no explicit instantiation definition |
574 | 572 | } |
575 | 573 | \end{codeblock} |
576 | 574 | \end{example} |
|
590 | 588 | \begin{example} |
591 | 589 | \begin{codeblock} |
592 | 590 | template <class T> typename T::X h(typename A<T>::X); |
593 | | -template <class T> auto h(typename A<T>::X) -> typename T::X; // redeclaration |
| 591 | +template <class T> auto h(typename A<T>::X) -> typename T::X; // redeclaration |
594 | 592 | template <class T> void h(...) { } |
595 | 593 |
|
596 | 594 | void x() { |
597 | | - h<int>(0); // ill-formed, no diagnostic required |
| 595 | + h<int>(0); // ill-formed, no diagnostic required |
598 | 596 | } |
599 | 597 | \end{codeblock} |
600 | 598 | \end{example} |
0 commit comments