view gcc/testsuite/g++.dg/conversion/bitfield10.C @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR c++/38007
// We need to use the conversion function to the declared type of a bitfield,
// not the lowered bitfield type.
// { dg-do link }

struct A
{
  operator unsigned int() { return 42; }
  operator unsigned char();
};

struct B
{
  unsigned int b : 8;
};

int
main ()
{
  A u;
  unsigned int v = u;
  B w;
  w.b = u;
}