Title
LWG 2989 breaks directory_entry stream insertion
Status
new
Section
[fs.class.directory_entry]
Submitter
Tim Song

Created on 2018-12-03.00:00:00, last changed 2018-12-04.02:52:00.

Messages

Date: 2018-12-04.02:52:00

Proposed resolution:

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-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
2018-12-04 02:52:00adminsetmessages: + msg10246
2018-12-03 00:00:00admincreate