public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94242] New: filesystem::path::generic_string() only works with std::allocator
@ 2020-03-20 21:09 redi at gcc dot gnu.org
  2020-03-20 21:10 ` [Bug libstdc++/94242] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-20 21:09 UTC (permalink / raw)
  To: gcc-bugs

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);
      |                   ^~~~~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/94242] filesystem::path::generic_string() only works with std::allocator
  2020-03-20 21:09 [Bug libstdc++/94242] New: filesystem::path::generic_string() only works with std::allocator redi at gcc dot gnu.org
@ 2020-03-20 21:10 ` redi at gcc dot gnu.org
  2020-03-21 22:05 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-20 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-03-20

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/94242] filesystem::path::generic_string() only works with std::allocator
  2020-03-20 21:09 [Bug libstdc++/94242] New: filesystem::path::generic_string() only works with std::allocator redi at gcc dot gnu.org
  2020-03-20 21:10 ` [Bug libstdc++/94242] " redi at gcc dot gnu.org
@ 2020-03-21 22:05 ` cvs-commit at gcc dot gnu.org
  2020-03-21 22:15 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-21 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:9fc985118d9f5014afc1caf32a411ee5803fba61

commit r10-7317-g9fc985118d9f5014afc1caf32a411ee5803fba61
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Mar 21 21:51:07 2020 +0000

    libstdc++: Fix path::generic_string allocator handling (PR 94242)

    It's not possible to construct a path::string_type from an allocator of
    a different type. Create the correct specialization of basic_string, and
    adjust path::_S_str_convert to use a basic_string_view so that it is
    independent of the allocator type.

            PR libstdc++/94242
            * include/bits/fs_path.h (path::_S_str_convert): Replace first
            parameter with basic_string_view so that strings with different
            allocators can be accepted.
            (path::generic_string<C,T,A>()): Use basic_string object that uses
the
            right allocator type.
            * testsuite/27_io/filesystem/path/generic/94242.cc: New test.
            * testsuite/27_io/filesystem/path/generic/generic_string.cc:
Improve
            test coverage.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/94242] filesystem::path::generic_string() only works with std::allocator
  2020-03-20 21:09 [Bug libstdc++/94242] New: filesystem::path::generic_string() only works with std::allocator redi at gcc dot gnu.org
  2020-03-20 21:10 ` [Bug libstdc++/94242] " redi at gcc dot gnu.org
  2020-03-21 22:05 ` cvs-commit at gcc dot gnu.org
@ 2020-03-21 22:15 ` redi at gcc dot gnu.org
  2020-08-07 10:40 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-21 22:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/94242] filesystem::path::generic_string() only works with std::allocator
  2020-03-20 21:09 [Bug libstdc++/94242] New: filesystem::path::generic_string() only works with std::allocator redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-21 22:15 ` redi at gcc dot gnu.org
@ 2020-08-07 10:40 ` cvs-commit at gcc dot gnu.org
  2020-08-07 11:43 ` cvs-commit at gcc dot gnu.org
  2020-08-07 11:43 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-07 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:e7406c364496dae51ef294b5720923fe4a1dfccb

commit r9-8792-ge7406c364496dae51ef294b5720923fe4a1dfccb
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Mar 21 21:51:07 2020 +0000

    libstdc++: Fix path::generic_string allocator handling (PR 94242)

    It's not possible to construct a path::string_type from an allocator of
    a different type. Create the correct specialization of basic_string, and
    adjust path::_S_str_convert to use a basic_string_view so that it is
    independent of the allocator type.

            PR libstdc++/94242
            * include/bits/fs_path.h (path::_S_str_convert): Replace first
            parameter with basic_string_view so that strings with different
            allocators can be accepted.
            (path::generic_string<C,T,A>()): Use basic_string object that uses
the
            right allocator type.
            * testsuite/27_io/filesystem/path/generic/94242.cc: New test.
            * testsuite/27_io/filesystem/path/generic/generic_string.cc:
Improve
            test coverage.

    (cherry picked from commit 9fc985118d9f5014afc1caf32a411ee5803fba61)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/94242] filesystem::path::generic_string() only works with std::allocator
  2020-03-20 21:09 [Bug libstdc++/94242] New: filesystem::path::generic_string() only works with std::allocator redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-08-07 10:40 ` cvs-commit at gcc dot gnu.org
@ 2020-08-07 11:43 ` cvs-commit at gcc dot gnu.org
  2020-08-07 11:43 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-07 11:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:39a5a04daa09c711caeb6aaff12f1d03406fe29f

commit r8-10392-g39a5a04daa09c711caeb6aaff12f1d03406fe29f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Mar 21 21:51:07 2020 +0000

    libstdc++: Fix path::generic_string allocator handling (PR 94242)

    It's not possible to construct a path::string_type from an allocator of
    a different type. Create the correct specialization of basic_string, and
    adjust path::_S_str_convert to use a basic_string_view so that it is
    independent of the allocator type.

            PR libstdc++/94242
            * include/bits/fs_path.h (path::_S_str_convert): Replace first
            parameter with basic_string_view so that strings with different
            allocators can be accepted.
            (path::generic_string<C,T,A>()): Use basic_string object that uses
the
            right allocator type.
            * testsuite/27_io/filesystem/path/generic/94242.cc: New test.
            * testsuite/27_io/filesystem/path/generic/generic_string.cc:
Improve
            test coverage.

    (cherry picked from commit 9fc985118d9f5014afc1caf32a411ee5803fba61)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/94242] filesystem::path::generic_string() only works with std::allocator
  2020-03-20 21:09 [Bug libstdc++/94242] New: filesystem::path::generic_string() only works with std::allocator redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-08-07 11:43 ` cvs-commit at gcc dot gnu.org
@ 2020-08-07 11:43 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-08-07 11:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 8.5 and 9.4 too.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-07 11:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 21:09 [Bug libstdc++/94242] New: filesystem::path::generic_string() only works with std::allocator redi at gcc dot gnu.org
2020-03-20 21:10 ` [Bug libstdc++/94242] " redi at gcc dot gnu.org
2020-03-21 22:05 ` cvs-commit at gcc dot gnu.org
2020-03-21 22:15 ` redi at gcc dot gnu.org
2020-08-07 10:40 ` cvs-commit at gcc dot gnu.org
2020-08-07 11:43 ` cvs-commit at gcc dot gnu.org
2020-08-07 11:43 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).