aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/pr64037.C
blob: e5cd0e2ee17850c8504f32185516ac79c4382a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-std=c++11 -Os" }

enum class X : unsigned char {
  V = 2,
};

static void
__attribute__((noinline,noclone))
foo(unsigned &out, unsigned a, X b)
{
  out = static_cast<unsigned>(b);
}

int main()
{
  unsigned deadbeef = 0xDEADBEEF;
  asm volatile ("" : "+d" (deadbeef), "+c" (deadbeef));

  unsigned out;
  foo(out, 2, X::V);

  if (out != 2)
    __builtin_abort ();

  return 0;
}