Title
`meta::access_context` should be a consteval-only type
Status
voting
Section
[meta.reflection.access.context]
Submitter
Jakub Jelinek

Created on 2025-10-20.00:00:00 last changed 12 hours ago

Messages

Date: 2025-10-27.10:00:32

Proposed resolution:

This wording is relative to N5014.

  1. Modify [meta.reflection.access.context] as indicated:

    -1- The class `access_context` class is a non-aggregate type that represents a namespace, class, or function from which queries pertaining to access rules may be performed, as well as the designating class ([class.access.base]), if any.

    -2- An `access_context` has an associated scope and designating class.

    namespace std::meta {
      struct access_context {
        access_context() = delete;
    
        consteval info scope() const;
        consteval info designating_class() const;
    
        static consteval access_context current() noexcept;
        static consteval access_context unprivileged() noexcept;
        static consteval access_context unchecked() noexcept;
        consteval access_context via(info cls) const;
      };
    }

    -3- `access_context` is a structural, consteval-only, non-aggregate type. Two values `ac1` and `ac2` of type `access_context` are template-argument-equivalent ([temp.type]) if `ac1.scope()` and `ac2.scope()` are template-argument-equivalent and `ac1.designating_class()` and `ac2.designating_class()` are template-argument-equivalent.

Date: 2025-10-15.00:00:00

[ 2025-10-23; Reflector poll. ]

Set status to Tentatively Ready after six votes in favour during reflector poll.

Date: 2025-10-15.00:00:00

[ 2025-10-23; Reflector poll. Adjust proposed wording. ]

Set priority to 2 after reflector poll.

Reflector discussion requested that 'non-aggregate' and 'consteval-only' both be put in paragraph 3, adjacent to 'structural'. Also added a drive-by editorial change to paragraph 1.

Date: 2025-10-20.00:00:00

The `meta::access_context` type is expected to contain some `meta::info` objects, which would make it a consteval-only type. But we don't actually specify any members, so nothing in the current specification says you can't persist one until runtime.

History
Date User Action Args
2025-10-30 17:45:31adminsetstatus: ready -> voting
2025-10-27 10:00:32adminsetmessages: + msg15456
2025-10-27 10:00:32adminsetstatus: new -> ready
2025-10-23 09:40:41adminsetmessages: + msg15374
2025-10-20 12:26:31adminsetmessages: + msg15266
2025-10-20 00:00:00admincreate