Debian Codegraph @

gcc/testsuite/g++.dg/opt/pr93210.C

raw
1 // PR tree-optimization/93210
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-O2 -fdump-tree-optimized" }
4 // { dg-final { scan-tree-dump-not "static_member\.d" "optimized" } }
5
6 union U { struct { unsigned int a, b; } c; unsigned long long d; };
7
8 inline
9 bool operator == (U const &x, U const &y) noexcept
10 {
11 return x.d == y.d;
12 };
13
14 struct S
15 {
16 static constexpr U static_member = { { 13, 42 } };
17 bool foo (U const &y) const noexcept;
18 bool bar (U const &y) const noexcept;
19 };
20
21 #if __cpp_inline_variables < 201606L
22 constexpr U S::static_member;
23 #endif
24
25 #if __SIZEOF_INT__ * 2 == __SIZEOF_LONG_LONG__
26 bool
27 S::foo (U const &y) const noexcept
28 {
29 return static_member == y;
30 }
31
32 bool
33 S::bar (U const &y) const noexcept
34 {
35 return U (static_member) == y;
36 }
37 #endif