Parse error related to templates
tveldhui
tveldhui@extreme.indiana.edu
Thu Oct 8 08:53:00 GMT 1998
This program gives a parse error with egcs 1.1b. As far as I know, it
is correct (EDG parsers it). It ought to compile successfully with
-ftemplate-depth-105.
// The infamous "3x+1" problem
template<int X>
struct foo {
static const int result = foo<(X % 2 == 0) ? (X/2) : (3*X+1)>::result;
};
template<>
struct foo<1> {
static const int result = 0;
};
const int j = foo<3578>::result;
More information about the Gcc-bugs
mailing list