gcc/testsuite/g++.dg/pr64037.C
raw| 1 | // { dg-do run { target i?86-*-* x86_64-*-* } } |
| 2 | // { dg-options "-std=c++11 -Os" } |
| 3 | |
| 4 | enum class X : unsigned char { |
| 5 | V = 2, |
| 6 | }; |
| 7 | |
| 8 | static void |
| 9 | __attribute__((noinline,noclone)) |
| 10 | foo(unsigned &out, unsigned a, X b) |
| 11 | { |
| 12 | out = static_cast<unsigned>(b); |
| 13 | } |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | unsigned deadbeef = 0xDEADBEEF; |
| 18 | asm volatile ("" : "+d" (deadbeef), "+c" (deadbeef)); |
| 19 | |
| 20 | unsigned out; |
| 21 | foo(out, 2, X::V); |
| 22 | |
| 23 | if (out != 2) |
| 24 | __builtin_abort (); |
| 25 | |
| 26 | return 0; |
| 27 | } |