[expr.prim.req.compound]

# 7 Expressions [[expr]](./#expr)

## 7.5 Primary expressions [[expr.prim]](expr.prim#req.compound)

### 7.5.8 Requires expressions [[expr.prim.req]](expr.prim.req#compound)

#### 7.5.8.4 Compound requirements [expr.prim.req.compound]

[compound-requirement:](#nt:compound-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]")  
{ [*expression*](expr.comma#nt:expression "7.6.20 Comma operator [expr.comma]") } noexceptopt [*return-type-requirement*](#nt:return-type-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]")opt ;

[return-type-requirement:](#nt:return-type-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]")  
-> [*type-constraint*](temp.param#nt:type-constraint "13.2 Template parameters [temp.param]")

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L3396)

A [*compound-requirement*](#nt:compound-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]") asserts properties
of the [*expression*](expr.comma#nt:expression "7.6.20 Comma operator [expr.comma]") E[.](#1.sentence-1)

The [*expression*](expr.comma#nt:expression "7.6.20 Comma operator [expr.comma]") is an unevaluated operand[.](#1.sentence-2)

Substitution
of template arguments (if any) and verification of
semantic properties proceed in the following order:

- [(1.1)](#1.1)

  Substitution of template arguments (if any)
into the [*expression*](expr.comma#nt:expression "7.6.20 Comma operator [expr.comma]") is performed[.](#1.1.sentence-1)

- [(1.2)](#1.2)

  If the noexcept specifier is present,E shall not be a potentially-throwing expression ([[except.spec]](except.spec "14.5 Exception specifications"))[.](#1.2.sentence-1)

- [(1.3)](#1.3)

  If the [*return-type-requirement*](#nt:return-type-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]") is present, then:
  * [(1.3.1)](#1.3.1)

      Substitution of template arguments (if any)
into the [*return-type-requirement*](#nt:return-type-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]") is performed[.](#1.3.1.sentence-1)

  * [(1.3.2)](#1.3.2)

      The immediately-declared constraint ([[temp.param]](temp.param "13.2 Template parameters"))
of the [*type-constraint*](temp.param#nt:type-constraint "13.2 Template parameters [temp.param]") for decltype((E)) shall be satisfied[.](#1.3.2.sentence-1)

  [*Example [1](#example-1)*:
  Given concepts C and D,requires {{ E1 } -> C; { E2 } -> D<A1, â¯, An>;}; is equivalent torequires { E1; requires C<decltype((E1))>;
 E2; requires D<decltype((E2)), A1, â¯, An>;}; (including in the case where n is zero)[.](#1.3.sentence-2)
 â *end example*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L3442)

[*Example [2](#example-2)*: template<typename T> concept C1 = requires(T x) {{x++};};

The [*compound-requirement*](#nt:compound-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]") in C1 requires that x++ is a valid expression[.](#2.sentence-1)

It is equivalent to the [*simple-requirement*](expr.prim.req.simple#nt:simple-requirement "7.5.8.2 Simple requirements [expr.prim.req.simple]")x++;[.](#2.sentence-2)

template<typename T> concept C2 = requires(T x) {{*x} -> std::[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<typename T::inner>;};

The [*compound-requirement*](#nt:compound-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]") in C2 requires that *x is a valid expression,
that typename T​::​inner is a valid type, and
that std​::​[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<decltype((*x)), typename T​::​inner> is satisfied[.](#2.sentence-3)

template<typename T> concept C3 =requires(T x) {{g(x)} noexcept; };

The [*compound-requirement*](#nt:compound-requirement "7.5.8.4 Compound requirements [expr.prim.req.compound]") in C3 requires that g(x) is a valid expression and
that g(x) is non-throwing[.](#2.sentence-4)

â *end example*]
