// { dg-do assemble } template struct meta_max { enum { max = (N1 > N2) ? N1 : N2 }; }; struct X { enum { a = 0, n = 0 }; }; template 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::max }; }; int z = Y::a;