aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/arrow3.C
blob: b2029ba4894d749dfbfd4ec2e65d37bcb13b07dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// PR c++/56895
// { dg-do compile }

extern struct A { bool foo (); A bar (); } *a;

template <int>
int
baz1 ()
{
  return 2 << (a->bar().foo() ? 1 : 0);
}

template <int>
int
baz2 ()
{
  return 2 >> (a->bar().foo() ? 1 : 0);
}

template <int>
int
baz3 ()
{
  return 10 / (a->bar().foo() ? 1 : 2);
}

template <int>
int
baz4 ()
{
  return 10 % (a->bar().foo() ? 1 : 0);
}

int
test ()
{
  return baz1<0> () + baz2<0> () + baz3<0> () + baz4<0> ();
}