Debian Codegraph @

gcc/testsuite/g++.dg/conversion/bitfield8.C

raw
1 // PR c++/35056
2 // { dg-do compile }
3 // { dg-options "-O2" }
4
5 enum EBorderStyle { bla = 1 };
6 inline bool compare_ref(const unsigned int &t, const EBorderStyle &u)
7 { return t == u; }
8 inline bool compare_val(const unsigned int t, const EBorderStyle u)
9 { return t == u; }
10 struct S {
11 unsigned m_style : 4;
12 };
13 void call_ref (S *s, EBorderStyle v)
14 { if (!compare_ref(s->m_style, v)) s->m_style = v; }
15 void call_val (S *s, EBorderStyle v)
16 { if (!compare_val(s->m_style, v)) s->m_style = v; }