Debian Codegraph @

gcc/testsuite/g++.dg/opt/pr19317-1.C

raw
1 // PR c++/19317
2 // { dg-options "-O2" }
3 // { dg-do run }
4 // Origin: Dirk Mueller <[email protected]>
5
6 extern "C" void abort (void);
7
8 struct A
9 {
10 A () { d = e = 0; f = -1; }
11 A (int x) : d (0), e (0), f (x) { }
12 A b (const A &r) const;
13 int d;
14 int e;
15 int f;
16 };
17
18 A
19 A::b (const A & r) const
20 {
21 A t;
22 t.f = f < r.f ? f : r.f;
23 return t;
24 }
25
26 int
27 main ()
28 {
29 A a (100);
30 a = a.b (A (10));
31 if (a.f != 10)
32 abort ();
33
34 A c (10);
35 A d (100);
36 c = d.b (c);
37 if (c.f != 10)
38 abort ();
39 }