Title
LWG 2989 breaks directory_entry stream insertion
Status
c++23
Section
[fs.class.directory.entry]
Submitter
Tim Song

Created on 2018-12-03.00:00:00 last changed 12 months ago

Messages

Date: 2020-11-09.21:40:50

Proposed resolution:

This wording is relative to N4861.

  1. Modify [fs.class.directory.entry], class directory_entry synopsis, as follows:

    namespace std::filesystem {
      class directory_entry {
      public:
        […]
        bool operator==(const directory_entry& rhs) const noexcept;
        strong_ordering operator<=>(const directory_entry& rhs) const noexcept;
        
        // 29.11.11.? [fs.dir.entry.io], inserter    
        template<class charT, class traits>
          friend basic_ostream<charT, traits>&
            operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
      private:
        […]
      };
    }
    
  2. Add a new subclause at the end of [fs.class.directory.entry], as indicated:

    29.11.11.? Inserter [fs.dir.entry.io]

    template<class charT, class traits>
      friend basic_ostream<charT, traits>&
        operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
    

    -?- Effects: Equivalent to: return os << d.path();

Date: 2020-11-09.00:00:00

[ 2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP. ]

Date: 2020-08-21.00:00:00

[ 2020-08-21 Issue processing telecon: moved to Tentatively Ready ]

Date: 2020-05-15.00:00:00

[ 2020-05-02; Daniel resyncs wording with recent working draft and comments ]

We have now the paper P1965R0, which introduced a specification of what friend functions in the library specification (see [hidden.friends]) are supposed to mean, there is no longer an inline definition needed to clarify the meaning. In addition to updating the change of section names the provided wording has moved the friend declaration into the public part of the class definition as have done in all other cases where we take advantage of "hidden friends" declarations.

Date: 2020-05-02.15:21:21

[ 2019-02; Kona Wednesday night issue processing ]

Status to Open; Marshall to move definition inline and re-vote on reflector.

Jonathan to write a paper about how to specify "hidden friends".

Previous resolution [SUPERSEDED]:

This wording is relative to N4778.

  1. Modify [fs.class.directory_entry], class directory_entry synopsis, as follows:

    namespace std::filesystem {
      class directory_entry {
      public:
        […]
      private:
        filesystem::path pathobject;     // exposition only
        friend class directory_iterator; // exposition only
    
        template<class charT, class traits>
          friend basic_ostream<charT, traits>&
            operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
      };
    }
    
  2. Add a new subclause at the end of [fs.class.directory_entry], as follows:

    28.11.11.4 Inserter [fs.dir.entry.io]

    template<class charT, class traits>
      friend basic_ostream<charT, traits>&
        operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
    

    -1- Effects: Equivalent to: return os << d.path();

Date: 2018-12-21.00:00:00

[ 2018-12-21 Reflector prioritization ]

Set Priority to 2

Date: 2018-12-03.00:00:00

directory_entry has a conversion function to const path& and depends on path's stream insertion operator for stream insertion support, which is now broken after LWG 2989 made it a hidden friend.

This does not appear to be intended.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2020-11-09 21:40:50adminsetmessages: + msg11557
2020-11-09 21:40:50adminsetstatus: ready -> wp
2020-08-21 20:56:44adminsetmessages: + msg11454
2020-08-21 20:56:44adminsetstatus: open -> ready
2020-05-02 14:05:50adminsetmessages: + msg11256
2019-02-21 17:23:36adminsetmessages: + msg10322
2019-02-21 17:23:36adminsetstatus: new -> open
2018-12-21 15:26:00adminsetmessages: + msg10262
2018-12-04 02:52:00adminsetmessages: + msg10246
2018-12-03 00:00:00admincreate