Debian Codegraph @

gcc/testsuite/g++.dg/template/arrow3.C

raw
1 // PR c++/56895
2 // { dg-do compile }
3
4 extern struct A { bool foo (); A bar (); } *a;
5
6 template <int>
7 int
8 baz1 ()
9 {
10 return 2 << (a->bar().foo() ? 1 : 0);
11 }
12
13 template <int>
14 int
15 baz2 ()
16 {
17 return 2 >> (a->bar().foo() ? 1 : 0);
18 }
19
20 template <int>
21 int
22 baz3 ()
23 {
24 return 10 / (a->bar().foo() ? 1 : 2);
25 }
26
27 template <int>
28 int
29 baz4 ()
30 {
31 return 10 % (a->bar().foo() ? 1 : 0);
32 }
33
34 int
35 test ()
36 {
37 return baz1<0> () + baz2<0> () + baz3<0> () + baz4<0> ();
38 }