Skip to content

[func.wrap.ref.class, func.wrap.ref.deduct] Inconsistent parameter #6362

Closed
@JohelEGP

Description

@JohelEGP
Contributor

In the class synopsis:

  template<auto f>
    function_ref(nontype_t<f>, auto) -> function_ref<see below>;

The detailed specifications uses a forwarding parameter.
That's consistent with the actual constructors,
as it doesn't require copy on the caller side when deducing.

    function_ref(nontype_t<f>, auto&&) -> function_ref<@\seebelow@>;

In the deduction guide's detailed specifications:

template<auto f, class T>
  function_ref(nontype_t<f>, T&&) -> function_ref<see below>;

The second parameter in the class synopsis is actually auto.
That requires a copy, as opposed to T&&.
So I can't solve this editorially here,
but it can be done in the class synopsis.

To be consistent with my suggestion on the class synopsis:

template<auto f>
  function_ref(nontype_t<f>, auto&&) -> function_ref<@\seebelow@>;

Originally: #6357 (comment), #6357 (comment).

Activity

frederick-vs-ja

frederick-vs-ja commented on Jun 29, 2023

@frederick-vs-ja
Contributor

Presumably the second auto shouldn't be used here, see CWG2697.

JohelEGP

JohelEGP commented on Jun 29, 2023

@JohelEGP
ContributorAuthor

Thank you.
For now, I suggested #6357 (comment).
If that's not editorially accepted, an LWG issue might be needed.

tkoeppe

tkoeppe commented on Jul 21, 2023

@tkoeppe
Contributor

Could you please make a separate PR for this, after the motions?

JohelEGP

JohelEGP commented on Jul 21, 2023

@JohelEGP
ContributorAuthor

Yes.
Remaining motions: https://github.com/cplusplus/draft/issues?q=is%3Aissue+is%3Aopen+Motion+in%3Atitle.
Commit to be rebased on main afterwards: 34305cc.

JohelEGP

JohelEGP commented on Jul 22, 2023

@JohelEGP
ContributorAuthor

Opened #6398.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @tkoeppe@JohelEGP@frederick-vs-ja

      Issue actions

        [func.wrap.ref.class, func.wrap.ref.deduct] Inconsistent parameter · Issue #6362 · cplusplus/draft