gcc/testsuite/g++.dg/conversion/bitfield10.C
raw| 1 | // PR c++/38007 |
| 2 | // We need to use the conversion function to the declared type of a bitfield, |
| 3 | // not the lowered bitfield type. |
| 4 | // { dg-do link } |
| 5 | |
| 6 | struct A |
| 7 | { |
| 8 | operator unsigned int() { return 42; } |
| 9 | operator unsigned char(); |
| 10 | }; |
| 11 | |
| 12 | struct B |
| 13 | { |
| 14 | unsigned int b : 8; |
| 15 | }; |
| 16 | |
| 17 | int |
| 18 | main () |
| 19 | { |
| 20 | A u; |
| 21 | unsigned int v = u; |
| 22 | B w; |
| 23 | w.b = u; |
| 24 | } |