This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] [PR/13243] Detect more non constant expressions (regression in mainline)


On 08 Dec 2003 05:27:12 +0100, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:

> "Giovanni Bajo" <giovannibajo@libero.it> writes:
>
> | Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
> | 
> | >> expression. Moreover, expressions like INDIRECT_REF and ADDR_EXPR are
> | >> always invalid as constant expressions.
> | >
> | > I am a bit nervous about that statement.  References get transformed
> | > (from time to time) into INDIRECT_REF, but a reference can be a valid
> | > constant expression.  The same is true for an ADDR_EXPR.  Did you check
> | > that?
> | 
> | Yes, I apologize for being unclear. What my patch disallows is "unary *" and
> | "unary &", which are directly built as INDIRECT_REF and ADDR_EXPR at parsing
> | time. If you look at the patch, the check is done within
> | cp_parser_unary_expression. I'm not disallowing those tree codes everywhere.
> | Does this sound better?
>
> Yes.  Thanks.

No.  There are address constant-expressions, too, as described in 5.19p4.

However, the parser code for constant_expression_p seems to be checking for
*integral* constant-expressions, not other types of constant-expressions,
and so your new test is appropriate.  The name should be fixed accordingly,
as should the error message in your patch and the comment in your testcase.

Also, we don't capitalize the first letter in an error message.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]