https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94242

            Bug ID: 94242
           Summary: filesystem::path::generic_string() only works with
                    std::allocator
           Product: gcc
           Version: 9.3.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <filesystem>

template<typename T>
struct A
{
  using value_type = T;

  T* allocate(std::size_t n) { return std::allocator<T>().allocate(n); }
  void deallocate(T* p, std::size_t n) { std::allocator<T>().deallocate(p, n);
}
};

std::filesystem::path p;
std::basic_string<char, std::char_traits<char>, A<char>> s
  = p.generic_string<char, std::char_traits<char>, A<char>>();


Compiled with -std=gnu++17:

In file included from /home/jwakely/gcc/10/include/c++/10.0.1/filesystem:45,
                 from gen.cc:1:
/home/jwakely/gcc/10/include/c++/10.0.1/bits/fs_path.h: In instantiation of
'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>
std::filesystem::__cxx11::path::generic_string(const _Allocator&) const [with
_CharT = char; _Traits = std::char_traits<char>; _Allocator = A<char>]':
gen.cc:14:61:   required from here
/home/jwakely/gcc/10/include/c++/10.0.1/bits/fs_path.h:1129:19: error: no
matching function for call to
'std::__cxx11::basic_string<char>::basic_string(const A<char>&)'
 1129 |       string_type __str(__a);
      |                   ^~~~~

Reply via email to