Open frederick-vs-ja opened 1 month ago
I've made CWG2924 for this.
I've thought a little more about this, and it seems just fixing the note in [defns.undefined] is a plausible approach, given that we already have "library" undefined behavior in constant expressions anyway.
However, "as if the attribute is ignored" seems also like a plausible approach.
Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [expr.const], [dcl.attr.assume], [dcl.attr.noreturn]
Link to reflector thread (if any):
Issue description:
Per the discussion in cplusplus/draft#7206, the intent seems to be that in the evaluation of a constant expression, violation of the restrictions of standard attributes either make the expression not a constant expression or has no effect, and no UB should be introduced in constant evaluation.
Suggested resolution:
Modify [expr.const] as indicated:
Modify [dcl.attr.assume] as indicated:
Add a new note after [dcl.attr.assume] Note 1:
Modify [dcl.attr.noreturn] as indicated:
Add a new note after [dcl.attr.noreturn] Note 1: