[c++-concepts]: Requires expression

Gabriel Dos Reis gdr@axiomatics.org
Sat Jun 22 16:13:00 GMT 2013


Andrew Sutton <andrew.n.sutton@gmail.com> writes:

| Like this?
| 
| // Parse a requires clause.
| //
| //    requires-clause:
| //      'requires' logical-or-expression
| //
| // The required logical-or-expression must be a constant expression.
| static 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;
| }

Perfect!

| Okay to commit?

Yes.  Thanks,

-- Gaby



More information about the Gcc-patches mailing list