[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sun C++ bug with stdbool
From: |
Paul Eggert |
Subject: |
Re: Sun C++ bug with stdbool |
Date: |
Fri, 16 Apr 2010 15:39:38 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Eric Blake <address@hidden> writes:
> char h[(bool)0.0==0?1:-1];
> $ CC -c foo.cc
> "foo.cc", line 3: Error: An integer constant expression is required
> within the array subscript operator.
> ...
> Unfortunately, this compiler bug means that Sun CC fails test-stdbool.
> Should we just exempt line 53 if we detect the broken compiler, or
> should we make the stdbool module more robust by checking for this C++
> compiler bug with bool, and if present, use something like #define bool
> signed char?
First, doesn't the stdbool module already check for this bug? It has
code that looks like this:
char d[(bool) 0.5 == true ? 1 : -1];
Why does this work, while "char h[(bool)0.0==0?1:-1];" fails?
Second, I don' think that this particular test case is that important.
If we understand why it doesn't work, then the simplest thing to do is
to comment it out. (If we don't understand it, then I'd be a little
more cautious....)