Title
Constification for splice-expressions
Status
open
Section
7.5.9 [expr.prim.splice]
Submitter
Daniel M. Katz

Created on 2026-02-05.00:00:00 last changed 1 month ago

Messages

Date: 2026-02-22.21:43:25

(From submission #844.)

Consider:

  void f(int p)
    pre([&] { ++p; return true; }())         // error: unqualified-id 'p' has const type
    pre([&] { ++[:^^p:]; return true; }())   // OK
  {}

Constification inside contract assertions applies to unqualified-ids (used as an id-expression) only. Reflection makes it easy to to circumvent this restriction, even though reflection is a compile-time process that could also apply constification.

2026-02-22

Forwarded to EWG with paper issue #2621, by decision of the CWG chair.

History
Date User Action Args
2026-02-05 00:00:00admincreate