Thu 22 Jan 2004 08:59:48 AM UTC, original submission:
Recent g++ releases reject the code generated for
ausdruck: ZAHL(integer) | TEXT(casestring);
ausdruck combine(bool cond, int z, char *s)
{
return cond ? ZAHL(mkinteger(z)): TEXT(mkcasestring(s));
}
with the error
error: conditional expression between distinct pointer types `
kc::impl_ausdruck_ZAHL' and `kc::impl_ausdruck_TEXT' lacks a cast
This problem can be resolved by writing
return cond ? static_cast<ausdruck>(ZAHL(mkinteger(z))):
static_cast<ausdruck>(TEXT(mkcasestring(s)));
However, this reformulation is difficult to read,
and may be difficult to write e.g. if the kimwitu code is
generated.
To avoid this kind of problem, and assuming that one
typically does not care about the operator type, anyway,
I'd like to see a different form of the operator, e.g.
spelled as
return cond ? ZAHL_(mkinteger(z)): TEXT_(mkcasestring(s))
|