Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expr.const] Consider using "non-constant library call" more generally #5813

Open
frederick-vs-ja opened this issue Sep 6, 2022 · 0 comments

Comments

@frederick-vs-ja
Copy link
Contributor

Currently serveral bullets in [expr.const] are mentioning standard library components.

Constant evaluation failure required:

(5.28) an invocation of the va_arg macro ([cstdarg.syn]);
(5.29) a non-constant library call ([defns.nonconst.libcall]); or

Unspecified whether constant evaluation fails:

(5.31) an operation that has undefined behavior as specified in [library] through [thread],
(5.32) an invocation of the va_start macro ([cstdarg.syn]), or

And in [bit.pow.two]/8, constant evaluation failure is required when bit_ceil call results in UB (generally not required for library UB).

Remarks: A function call expression that violates the precondition in the Preconditions: element is not a core constant expression ([expr.const]).

It may be a consistency improvement to specify all of these cases with "non-constant library call". Although only function invocation is specified in "non-constant library call", it seems easy to extend the definition to cover function-like macros.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant