Title
visit_format_arg and make_format_args are not hidden friends
Status
c++20
Section
[format.arg]
Submitter
Tim Song

Created on 2020-01-16.00:00:00 last changed 38 months ago

Messages

Date: 2020-02-01.13:16:12

Proposed resolution:

This wording is relative to N4842.

  1. Edit [format.arg], class template basic_format_arg synopsis, as indicated:

    namespace std {
      template<class Context>
      class basic_format_arg {
    
        […]
    
        template<class Visitor, class Ctx>
          friend auto visit_format_arg(Visitor&& vis,
                                       basic_format_arg<Ctx> arg);                  // exposition only
    
        template<class Ctx, class... Args>
          friend format-arg-store<Ctx, Args...>
            make_format_args(const Args&... args);                                  // exposition only
    
        […]
      };
    }
    
Date: 2020-02-01.00:00:00

[ 2020-02-01 Status set to Tentatively Ready after five positive votes on the reflector. ]

Date: 2020-01-17.18:15:08

After P1965R0, friend function and function template declarations always introduce hidden friends under the new blanket wording in [hidden.friends]. However, [format.arg] contains "exposition only" friend declarations of visit_format_arg and make_format_args, and those are not intended to be hidden. The only reason to have these declarations in the first place is because these function templates are specified using the exposition-only private data members of basic_format_arg, but that's unnecessary — for example, shared_ptr's constructors are not exposition-only friends of enable_shared_from_this, even though the former are shown as assigning to the latter's exposition-only weak_this private data member (see [util.smartptr.shared.const]p1).

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: immediate -> wp
2020-02-14 06:37:09adminsetstatus: ready -> immediate
2020-02-01 13:16:12adminsetmessages: + msg10973
2020-02-01 13:16:12adminsetstatus: new -> ready
2020-01-17 03:58:59adminsetmessages: + msg10942
2020-01-16 00:00:00admincreate