This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
casts to a type other than an integral or enumeration type in a constant-expression
- From: Fred Fish <fnf at public dot ninemoons dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Cc: ecos-discuss at sources dot redhat dot com, fnf at intrinsity dot com
- Date: Wed, 12 Feb 2003 11:53:22 -0700 (MST)
- Subject: [ECOS] casts to a type other than an integral or enumeration type in a constant-expression
- Reply-to: fnf at intrinsity dot com
The latest eCos sources no longer build with the latest gcc. The
problem can be tracked down to C++ code like the following in eCos:
#include <signal.h>
void foo (__sighandler_t __sighdl)
{
switch ((int) __sighdl)
{
case (int) SIG_DFL:
;
case (int) SIG_IGN:
;
}
}
Using "gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)" I get:
$ /usr/bin/g++ -c b.c
$
Using "gcc version 3.4 20030211 (experimental)" I get:
$ /usr/local/sourceware/bin/g++ -c b.c
b.c: In function `void foo(void (*)(int))':
b.c:7: error: a casts to a type other than an integral or enumeration type
cannot appear in a constant-expression
b.c:9: error: a casts to a type other than an integral or enumeration type
cannot appear in a constant-expression
$
Since it's unclear to me if this is a case of g++ becoming more picky
or the eCos code not being C++ compliant, I'm posting this to both the
eCos discussion list and the gcc bugs discussion list for comment.
If the compiler is correct, then I presume the eCos code needs to change
to something like:
if (__sighdl == SIG_DFL)
{
...
}
else if (__sighdl == SIG_IGN)
{
...
}
-Fred
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss