This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

3371. visit_format_arg and make_format_args are not hidden friends

Section: 20.20.6.1 [format.arg] Status: WP Submitter: Tim Song Opened: 2020-01-16 Last modified: 2020-02-24

Priority: 0

View all other issues in [format.arg].

View all issues with WP status.

Discussion:

After P1965R0, friend function and function template declarations always introduce hidden friends under the new blanket wording in 16.5.5.6 [hidden.friends]. However, 20.20.6.1 [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 20.11.3.1 [util.smartptr.shared.const]p1).

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

Proposed resolution:

This wording is relative to N4842.

  1. Edit 20.20.6.1 [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
    
        […]
      };
    }