@@ -66,6 +66,7 @@ constexpr variables
6666~~~~~~~~~~~~~~~~~~~
6767
6868- ``constexpr `` implies ``const ``.
69+ - ``constexpr `` is not allowed on ``typedef `` declarations.
6970- The initializer must be a constant expression (constant-evaluable).
7071- Allowed v1 types:
7172 - atomic types (bool, int, float, double, etc.)
@@ -76,8 +77,7 @@ constexpr variables
7677- Arrays must have fully specified sizes.
7778- Pointer values are limited to null or addresses of globals/functions.
7879- The value is available to constant-expression evaluation.
79- - Storage class and linkage follow existing rules (``constexpr `` does not
80- change them).
80+ - For variables, storage class and linkage follow existing rules.
8181
8282constexpr functions
8383~~~~~~~~~~~~~~~~~~~
@@ -87,6 +87,11 @@ constexpr functions
8787- The selected overload must be ``constexpr `` for constant evaluation.
8888- ``constexpr `` functions must be "constexpr-suitable" at definition time.
8989- The return type can be any constexpr-supported type (including aggregates).
90+ - ``constexpr `` is not allowed on function parameters.
91+ - Linkage follows C++ constexpr function behavior:
92+ - non-``static `` constexpr functions are emitted with ODR linkage
93+ (``linkonce_odr ``)
94+ - ``static `` constexpr functions have internal linkage
9095
9196constexpr-suitable validation (definition time)
9297~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -111,8 +116,8 @@ Disallowed (v1):
111116
112117- Writes to non-local storage (globals, captured references, or pointer
113118 dereference).
114- - Taking the address of local variables; only global/function addresses are
115- allowed.
119+ - Taking the address of local variables or parameters ; only global/function
120+ addresses are allowed.
116121- ``new ``, ``delete ``, ``launch ``, ``invoke_sycl ``, ``sync ``, ``print ``,
117122 atomics, and any other side-effecting builtins.
118123- ``foreach* `` statements (``foreach ``, ``foreach_active ``, ``foreach_unique ``).
@@ -272,6 +277,7 @@ constant-expression contexts.
272277^^^^^^^^^^^^^^^^^^^^^^^
273278
274279- ``constexpr `` implies ``const ``.
280+ - ``constexpr `` is not allowed on ``typedef `` declarations.
275281- The initializer must be a constant expression.
276282- V1 supports atomic, enum, pointer, short vector, array, and struct types.
277283- Arrays must have fully specified sizes.
@@ -301,11 +307,16 @@ Requirements (v1):
301307- The function body must be constexpr-suitable at definition time.
302308- The function must return a value (no ``void `` return in v1).
303309- The function may only call other ``constexpr `` functions.
310+ - ``constexpr `` is not allowed on function parameters.
304311- Control flow conditions must be uniform.
305312- Pointer dereference is not allowed; address-of is limited to
306- globals/functions.
313+ globals/functions (not locals/parameters) .
307314- ``task ``, ``export ``, and ``extern "C"/"SYCL" `` are not allowed on
308315 ``constexpr `` functions in v1.
316+ - Linkage follows C++ constexpr function behavior:
317+ - non-``static `` constexpr functions are emitted with ODR linkage
318+ (``linkonce_odr ``)
319+ - ``static `` constexpr functions have internal linkage
309320
310321Examples:
311322
0 commit comments