Created on 2025-03-24.00:00:00 last changed 1 week ago
(From submission #694.)
Is the use of defined valid in __has_embed? It is not valid in cases where it would be interpreted by the #if rules in #embed; see 15.4.2.1 [cpp.embed.param.limit] paragraph 1.
To avoid confusion, defined should also be prohibited inside __has_embed.
Possible resolution:
Change in 15.2 [cpp.cond] paragraph 1 as follows:
The expression that controls conditional inclusion shall be an integral constant expression except that identifiers (including those lexically identical to keywords) are interpreted as described below123 and it may contain zero or more defined-macro-expressions, has-include-expressions, has-attribute-expressions, and/or has-embed-expressions as unary operator expressions. A defined-macro-expression shall not appear within a has-include-expression or has-embed-expression.
Change in 15.4.2.1 [cpp.embed.param.limit] paragraph 1 as follows:
An embed-parameter of the form limit ( pp-balanced-token-seq ) specifies the maximum possible number of elements in the comma-delimited list. It shall appear at most once in the embed-parameter-seq. The preprocessing token defined shall not appear in the
constant-expressionpp-balanced-token-seq.The pp-balanced-token-seq is evaluated as a constant-expression using the rules as described in conditional inclusion (15.2 [cpp.cond]), but without being processed as in normal text an additional time.
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-03-24 00:00:00 | admin | create |