|
77 | 77 | void make_misaligned() |
78 | 78 | { |
79 | 79 | alignas(S) char s[sizeof(S) + 1]; |
80 | | - new (&s+1) S(); // undefined behavior |
| 80 | + new (&s+1) S(); // undefined behavior |
81 | 81 | } |
82 | 82 | \end{codeblock} |
83 | 83 | \end{example} |
|
253 | 253 | \begin{codeblock} |
254 | 254 | void g() { |
255 | 255 | int x [[ indeterminate ]]; |
256 | | - int y = x; // undefined behavior |
| 256 | + int y = x; // undefined behavior |
257 | 257 | } |
258 | 258 | \end{codeblock} |
259 | 259 | \end{example} |
|
300 | 300 | void test() |
301 | 301 | { |
302 | 302 | char* c = static_cast<char*>(operator new(0z)); |
303 | | - c[0] = 'X'; // undefined behavior |
| 303 | + c[0] = 'X'; // undefined behavior |
304 | 304 | } |
305 | 305 | \end{codeblock} |
306 | 306 | \end{example} |
|
481 | 481 | void f() |
482 | 482 | { |
483 | 483 | char u[sizeof(U)]; |
484 | | - U o = reinterpret_cast<U&>(u); // undefined behavior |
| 484 | + U o = reinterpret_cast<U&>(u); // undefined behavior |
485 | 485 | } |
486 | 486 | \end{codeblock} |
487 | 487 | \end{example} |
|
501 | 501 | int* ip = new int(5); |
502 | 502 | int& i = *ip; |
503 | 503 | delete ip; |
504 | | - i; // undefined behavior |
| 504 | + i; // undefined behavior |
505 | 505 | } |
506 | 506 | \end{codeblock} |
507 | 507 | \end{example} |
|
585 | 585 | \pnum |
586 | 586 | \ubxref{conv.ptr.virtual.base} \\ |
587 | 587 | Converting |
588 | | -a pointer to a derived class \tcode{D} |
| 588 | +a pointer to a derived class \tcode{D} |
589 | 589 | to |
590 | 590 | a pointer to a virtual base class \tcode{B} |
591 | 591 | that does not point to |
|
601 | 601 | void f() |
602 | 602 | { |
603 | 603 | D ds[1]; |
604 | | - B* b = &ds[1]; // undefined behavior |
| 604 | + B* b = &ds[1]; // undefined behavior |
605 | 605 | } |
606 | 606 | \end{codeblock} |
607 | 607 | \end{example} |
|
818 | 818 | int f() |
819 | 819 | { |
820 | 820 | int *p = nullptr; |
821 | | - return *p; // undefined behavior |
| 821 | + return *p; // undefined behavior |
822 | 822 | } |
823 | 823 | \end{codeblock} |
824 | 824 | \end{example} |
|
1270 | 1270 | \begin{example} |
1271 | 1271 | \begin{codeblock} |
1272 | 1272 | void f(float x); |
1273 | | -void (&g)(int) = reinterpret_cast<void (&)(int)>(f); // undefined behavior |
| 1273 | +void (&g)(int) = reinterpret_cast<void (&)(int)>(f); // undefined behavior |
1274 | 1274 | \end{codeblock} |
1275 | 1275 | \end{example} |
1276 | 1276 |
|
|
1286 | 1286 | \begin{example} |
1287 | 1287 | \begin{codeblock} |
1288 | 1288 | float g; |
1289 | | -int& i = reinterpret_cast<int&>(g); // undefined behavior |
| 1289 | +int& i = reinterpret_cast<int&>(g); // undefined behavior |
1290 | 1290 | \end{codeblock} |
1291 | 1291 | \end{example} |
1292 | 1292 |
|
|
1300 | 1300 | \begin{example} |
1301 | 1301 | \begin{codeblock} |
1302 | 1302 | extern int &ir1; |
1303 | | -int i2 = ir1; // undefined behavior, \tcode{ir1} not yet initialized |
| 1303 | +int i2 = ir1; // undefined behavior, \tcode{ir1} not yet initialized |
1304 | 1304 | int ir1 = 17; |
1305 | 1305 | \end{codeblock} |
1306 | 1306 | \end{example} |
|
1619 | 1619 | \begin{codeblock} |
1620 | 1620 | struct X { |
1621 | 1621 | int i; |
1622 | | - ~X(); // non-trivial |
| 1622 | + ~X(); // non-trivial |
1623 | 1623 | }; |
1624 | 1624 | X& g() |
1625 | 1625 | { |
|
1630 | 1630 | { |
1631 | 1631 | X& px = &g(); |
1632 | 1632 | px->~X(); |
1633 | | - int*p = px->i; // undefined behavior |
| 1633 | + int*p = px->i; // undefined behavior |
1634 | 1634 | } |
1635 | 1635 | \end{codeblock} |
1636 | 1636 | \end{example} |
|
1965 | 1965 | #define __cplusplus 300012L |
1966 | 1966 | \end{codeblock} |
1967 | 1967 | \end{example} |
1968 | | - |
0 commit comments