summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.robertl/eb11.C
blob: e5f29a157916643da91bf5c61455a36c1ebf0033 (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
// { dg-do assemble  }

template<int N1, int N2>
struct meta_max {
    enum { max = (N1 > N2) ? N1 : N2 };
};

struct X {
    enum {
       a = 0,
       n = 0
    };
};

template<class T1, class T2>
struct Y {

    enum {
       a = T1::a + T2::a,

       // NB: if the next line is changed to
       // n = (T1::n > T2::n) ? T1::n : T2::n
       // the problem goes away.

       n = meta_max<T1::n,T2::n>::max
    };
};

int z = Y<X,X>::a;