On 2005-04-27 12:29:53 +0100, Andrew Haley wrote:
> Vincent Lefevre writes:
>  > The only two constraints in 6.6 are:
>  > 
>  >        [#3] Constant  expressions  shall  not  contain  assignment,
>  >        increment,  decrement,  function-call,  or  comma operators,
>  >        except when they are contained within a  subexpression  that
>  >        is not evaluated.86)
>  > 
>  >        [#4] Each constant expression shall evaluate to  a  constant
>  >        that is in the range of representable values for its type.
>  > 
>  > #3 doesn't include variables. #4 is OK if one considers that the
>  > value cannot be modified.
>  > 
>  > #6 adds other requirements, but this is out of the scope of the
>  > given diagnostic (which complained about an expression not being a
>  > constant -- not because it wasn't an integer constant expression).
> 
> 6.7.8 Para 4.  All the expressions for an initializer for an object
>     that has static storage duration shall be constant expressions ...
                                                ^^^^^^^^^^^^^^^^^^^^
It is said "constant expressions", not "integer constant expressions".

> 6.6 Para 6.  An integer constant expression shall have integer type
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   and shall only have operands that are inetger constants, enumeration
>   constants, character constants, sizeof expressions whose results are
>   integer constants, and floating-point constans that are the
>   immediate operands of casts ...

#6 is about an *integer* constant expression.

>  > Couldn't the expression fall into #10 with some implementations?
> 
> Probably, but that would be yet another gcc-local extension.

Yes, but the diagnostic should be more accurate.

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

Reply via email to