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++-concepts]: Requires expression


> | +  // Concept extensions
> | +  case RID_REQUIRES:
> | +    return cp_parser_requires_expression (parser);
> | +
>
> I think you meant here "nested requirements", not "extensions" as in
> "GNU extensions" or "vendor lock-ins".  We should continue with "nested
> requirements" then.

This denotes a primary expression, not a nested requirement. I was
trying to subset the requirement like the "Objective-C++ expressions"
comment just below it.

I changed the comment to just "C++ concepts". We may get other primary
expressions related to concepts, although I don't have any planned.


> | +static inline tree
> | +cp_parser_requires_clause (cp_parser *parser)
> | +{
> | +  // Parse the constant expression.
> | +  tree expr =
> | +    cp_parser_binary_expression (parser, false, false, PREC_NOT_OPERATOR, NULL);
> | +  if (!require_potential_rvalue_constant_expression (expr))
> | +    return error_mark_node;
> | +  return expr;
>
> The grammar says "constant-expression".  You should use
> cp_parser_constant_expression.

When we started talking about requirements, we didn't want the full
breadth of an expression, so I limited it to a logical-or-expression
that is also a constant expression. Commas, assignments, and
conditions at the top-level seemed counter-intuitive.

Do we want to allow any constant expression, or should we just change
the docs to logical-or-expression that is also a constant expression?

Andrew


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