public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-21 14:17 ` pacoarjonilla at yahoo dot es
  2020-03-21 20:22 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pacoarjonilla at yahoo dot es @ 2020-03-21 14:17 UTC (permalink / raw)
  To: gcc-bugs

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

Paco Arjonilla <pacoarjonilla at yahoo dot es> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pacoarjonilla at yahoo dot es

--- Comment #4 from Paco Arjonilla <pacoarjonilla at yahoo dot es> ---
I got this error too. This is the code:



#include <filesystem>
#include <concepts>
struct A {
    A() = default;
    A(A const&) = default;
    A & operator = (A const&) = default;

    A(std::filesystem::path); // This line triggers the error.
};
static_assert(std::semiregular<A>);



There is no reason why an extra constructor would affect the semiregularity of
a type.



$> g++ -std=c++20

In file included from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/compare:39,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/stl_pair.h:65,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/stl_algobase.h:64,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/char_traits.h:39,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/string:40,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/stdexcept:39,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/system_error:41,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_fwd.h:35,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/filesystem:44,

                 from <source>:1:

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/stl_iterator_base_types.h:
In instantiation of 'struct std::iterator_traits<A>':

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:84:11:
  required by substitution of 'template<class _Iter, class _Iter_traits> using
__is_path_iter_src = std::__and_<std::__or_<std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, char>,
std::is_same<typename std::remove_const<typename
_Iter_traits::value_type>::type, char8_t>, std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, wchar_t>,
std::is_same<typename std::remove_const<typename
_Iter_traits::value_type>::type, char16_t>, std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, char32_t> >,
std::is_base_of<std::input_iterator_tag, typename
_Iter_traits::iterator_category> > [with _Iter = A; _Iter_traits =
std::iterator_traits<A>]'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:91:5:
  required by substitution of 'template<class _Iter>
std::filesystem::__cxx11::__detail::__is_path_iter_src<_Iter>
std::filesystem::__cxx11::__detail::__is_path_src(_Iter, int) [with _Iter = A]'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:115:29:
  required from 'struct
std::filesystem::__cxx11::__detail::__constructible_from<A, void>'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:138:12:
  required from 'struct std::__and_<std::__not_<std::is_void<A> >,
std::filesystem::__cxx11::__detail::__constructible_from<A, void> >'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:143:12:
  required from 'struct std::__and_<std::__not_<std::is_same<A,
std::filesystem::__cxx11::path> >, std::__not_<std::is_void<A> >,
std::filesystem::__cxx11::__detail::__constructible_from<A, void> >'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:119:11:
  required by substitution of 'template<class _Tp1, class _Tp2> using _Path =
typename std::enable_if<std::__and_<std::__not_<std::is_same<typename
std::remove_cv< <template-parameter-1-1> >::type,
std::filesystem::__cxx11::path> >, std::__not_<std::is_void<typename
std::remove_pointer<_Tp>::type> >,
std::filesystem::__cxx11::__detail::__constructible_from<_Tp1, _Tp2> >::value,
std::filesystem::__cxx11::path>::type [with _Tp1 = A; _Tp2 = void]'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:219:7:
  required by substitution of 'template<class _Source, class _Require>
std::filesystem::__cxx11::path::path(const _Source&,
std::filesystem::__cxx11::path::format) [with _Source = A; _Require =
<missing>]'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:901:30:
  required from 'struct std::__is_constructible_impl<A, A>'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:906:12:
  required from 'struct std::is_constructible<A, A>'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:3091:25:
  required from 'constexpr const bool std::is_constructible_v<A, A>'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/concepts:139:30:  
required from here

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/concepts:139:30:
error: the value of 'std::is_constructible_v<A, A>' is not usable in a constant
expression

  139 |       = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;

      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/move.h:57,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/nested_exception.h:40,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/exception:148,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/stdexcept:38,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/system_error:41,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_fwd.h:35,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/filesystem:44,

                 from <source>:1:

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:3091:25:
note: 'std::is_constructible_v<A, A>' used in its own initializer

 3091 |   inline constexpr bool is_constructible_v =

      |                         ^~~~~~~~~~~~~~~~~~

ASM generation compiler returned: 1

In file included from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/compare:39,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/stl_pair.h:65,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/stl_algobase.h:64,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/char_traits.h:39,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/string:40,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/stdexcept:39,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/system_error:41,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_fwd.h:35,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/filesystem:44,

                 from <source>:1:

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/stl_iterator_base_types.h:
In instantiation of 'struct std::iterator_traits<A>':

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:84:11:
  required by substitution of 'template<class _Iter, class _Iter_traits> using
__is_path_iter_src = std::__and_<std::__or_<std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, char>,
std::is_same<typename std::remove_const<typename
_Iter_traits::value_type>::type, char8_t>, std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, wchar_t>,
std::is_same<typename std::remove_const<typename
_Iter_traits::value_type>::type, char16_t>, std::is_same<typename
std::remove_const<typename _Iter_traits::value_type>::type, char32_t> >,
std::is_base_of<std::input_iterator_tag, typename
_Iter_traits::iterator_category> > [with _Iter = A; _Iter_traits =
std::iterator_traits<A>]'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:91:5:
  required by substitution of 'template<class _Iter>
std::filesystem::__cxx11::__detail::__is_path_iter_src<_Iter>
std::filesystem::__cxx11::__detail::__is_path_src(_Iter, int) [with _Iter = A]'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:115:29:
  required from 'struct
std::filesystem::__cxx11::__detail::__constructible_from<A, void>'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:138:12:
  required from 'struct std::__and_<std::__not_<std::is_void<A> >,
std::filesystem::__cxx11::__detail::__constructible_from<A, void> >'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:143:12:
  required from 'struct std::__and_<std::__not_<std::is_same<A,
std::filesystem::__cxx11::path> >, std::__not_<std::is_void<A> >,
std::filesystem::__cxx11::__detail::__constructible_from<A, void> >'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:119:11:
  required by substitution of 'template<class _Tp1, class _Tp2> using _Path =
typename std::enable_if<std::__and_<std::__not_<std::is_same<typename
std::remove_cv< <template-parameter-1-1> >::type,
std::filesystem::__cxx11::path> >, std::__not_<std::is_void<typename
std::remove_pointer<_Tp>::type> >,
std::filesystem::__cxx11::__detail::__constructible_from<_Tp1, _Tp2> >::value,
std::filesystem::__cxx11::path>::type [with _Tp1 = A; _Tp2 = void]'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_path.h:219:7:
  required by substitution of 'template<class _Source, class _Require>
std::filesystem::__cxx11::path::path(const _Source&,
std::filesystem::__cxx11::path::format) [with _Source = A; _Require =
<missing>]'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:901:30:
  required from 'struct std::__is_constructible_impl<A, A>'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:906:12:
  required from 'struct std::is_constructible<A, A>'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:3091:25:
  required from 'constexpr const bool std::is_constructible_v<A, A>'

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/concepts:139:30:  
required from here

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/concepts:139:30:
error: the value of 'std::is_constructible_v<A, A>' is not usable in a constant
expression

  139 |       = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;

      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/move.h:57,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/nested_exception.h:40,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/exception:148,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/stdexcept:38,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/system_error:41,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/bits/fs_fwd.h:35,

                 from
/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/filesystem:44,

                 from <source>:1:

/opt/compiler-explorer/gcc-trunk-20200321/include/c++/10.0.1/type_traits:3091:25:
note: 'std::is_constructible_v<A, A>' used in its own initializer

 3091 |   inline constexpr bool is_constructible_v =

      |                         ^~~~~~~~~~~~~~~~~~

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
  2020-03-21 14:17 ` [Bug libstdc++/93983] std::filesystem::path is not concept-friendly pacoarjonilla at yahoo dot es
@ 2020-03-21 20:22 ` redi at gcc dot gnu.org
  2020-05-12 21:42 ` gcc-bugs at marehr dot dialup.fu-berlin.de
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-21 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Paco Arjonilla from comment #4)
> There is no reason why an extra constructor would affect the semiregularity
> of a type.

That's not true.

A private or deleted constructor that is a better match for some arguments can
affect it.

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
  2020-03-21 14:17 ` [Bug libstdc++/93983] std::filesystem::path is not concept-friendly pacoarjonilla at yahoo dot es
  2020-03-21 20:22 ` redi at gcc dot gnu.org
@ 2020-05-12 21:42 ` gcc-bugs at marehr dot dialup.fu-berlin.de
  2020-05-12 22:43 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: gcc-bugs at marehr dot dialup.fu-berlin.de @ 2020-05-12 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

gcc-bugs at marehr dot dialup.fu-berlin.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc-bugs at marehr dot dialup.fu-b
                   |                            |erlin.de

--- Comment #6 from gcc-bugs at marehr dot dialup.fu-berlin.de ---
It seems that I hit the same issue when making us of ranges:

```c++
#include <filesystem>
#include <ranges>

static_assert(std::input_iterator<int *>);

struct alignment_file_input
{
  alignment_file_input(std::filesystem::path);

  template <typename stream_t>
  alignment_file_input(stream_t);

  int* begin();
  int* end();
};
static_assert(std::ranges::input_range<alignment_file_input>);

int main()
{
  alignment_file_input fin{int{}};

  auto && view = fin | std::views::take(1);
}
```

https://godbolt.org/z/__hw9w

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-05-12 21:42 ` gcc-bugs at marehr dot dialup.fu-berlin.de
@ 2020-05-12 22:43 ` redi at gcc dot gnu.org
  2020-05-21  0:35 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-12 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-05-12

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-05-12 22:43 ` redi at gcc dot gnu.org
@ 2020-05-21  0:35 ` redi at gcc dot gnu.org
  2020-05-21  1:11 ` rs2740 at gmail dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-21  0:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Lyberta from comment #0)
> #include <concepts>
> #include <filesystem>
> 
> struct Foo
> {
>     Foo(const std::filesystem::path& p);
> };
> 
> static_assert(std::copyable<Foo>);

The problem is that copyable<Foo> considers the Foo(const path&) constructor to
see if it can be called with a const Foo&. That considers this constructor with
Foo substituted for Source:

filesystem::path(Source const&, format = auto_format);

The constraints for Source involve checking whether Source is a
Cpp17InputIterator, which is done with this:

  template<typename _Iter,
           typename _Iter_traits = std::iterator_traits<_Iter>>
    using __is_path_iter_src
      = __and_<__is_encoded_char<typename _Iter_traits::value_type>,
               std::is_base_of<std::input_iterator_tag,
                               typename _Iter_traits::iterator_category>>;

So we instantiate iterator_traits<Foo>.

In C++20 finding the matching specialization for std::iterator_traits<Foo>
checks for concept satisfaction, which includes checking copyable<Foo> which is
recursive.

An even smaller reproducer is:

#include <iterator>

struct X
{
  template<typename T, typename = std::iterator_traits<T>::iterator_category>
    X(const T&);
};

static_assert( std::copyable<X> );

I can fix filesystem::path to avoid using iterator_traits, but this seems like
it's going to cause problems for plenty of other code too.

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2020-05-21  0:35 ` redi at gcc dot gnu.org
@ 2020-05-21  1:11 ` rs2740 at gmail dot com
  2020-05-21  5:57 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: rs2740 at gmail dot com @ 2020-05-21  1:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from TC <rs2740 at gmail dot com> ---
(really from Tim)

This is https://cplusplus.github.io/LWG/issue3420

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2020-05-21  1:11 ` rs2740 at gmail dot com
@ 2020-05-21  5:57 ` redi at gcc dot gnu.org
  2020-05-21  6:31 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-21  5:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks, Tim. I'd forgotten about that issue and was about to reinvent the
resolution.

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2020-05-21  5:57 ` redi at gcc dot gnu.org
@ 2020-05-21  6:31 ` redi at gcc dot gnu.org
  2020-05-21  6:39 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-21  6:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |s_gccbugzilla at nedprod dot com

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 95233 has been marked as a duplicate of this bug. ***

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2020-05-21  6:31 ` redi at gcc dot gnu.org
@ 2020-05-21  6:39 ` cvs-commit at gcc dot gnu.org
  2020-05-21  7:05 ` cvs-commit at gcc dot gnu.org
  2020-05-21  7:05 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-21  6:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 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:f094665d465cdf8903797cc58bea13007e588616

commit r11-541-gf094665d465cdf8903797cc58bea13007e588616
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu May 21 07:32:15 2020 +0100

    libstdc++: Avoid constraint recursion with iterator_traits (PR 93983)

    Checking whether a filesystem::path constructor argument is an iterator
    requires instantiating std::iterator_traits. In C++20 that checks for
    satisfaction of std::iterator_traits constraints, which checks if the
    type is copyable, which can end up recursing back to the path
    constructor. The fix in LWG 3420 is to reorder the cpp17-iterator
    concept's constraints to check if the type looks vaguely like an
    iterator before checking copyable. That avoids the recursion for types
    which definitely aren't iterators, but isn't foolproof.

            PR libstdc++/93983
            * include/bits/iterator_concepts.h (__detail::__cpp17_iterator):
            Reorder constraints to avoid recursion when constructors use
            iterator_traits (LWG 3420).
            * testsuite/24_iterators/customization_points/lwg3420.cc: New test.

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2020-05-21  6:39 ` cvs-commit at gcc dot gnu.org
@ 2020-05-21  7:05 ` cvs-commit at gcc dot gnu.org
  2020-05-21  7:05 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-21  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:566ba72126288272607374a32ac646dcd36fe584

commit r10-8163-g566ba72126288272607374a32ac646dcd36fe584
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu May 21 07:47:17 2020 +0100

    libstdc++: Avoid constraint recursion with iterator_traits (PR 93983)

    Checking whether a filesystem::path constructor argument is an iterator
    requires instantiating std::iterator_traits. In C++20 that checks for
    satisfaction of std::iterator_traits constraints, which checks if the
    type is copyable, which can end up recursing back to the path
    constructor. The fix in LWG 3420 is to reorder the cpp17-iterator
    concept's constraints to check if the type looks vaguely like an
    iterator before checking copyable. That avoids the recursion for types
    which definitely aren't iterators, but isn't foolproof.

    Backport from mainline
    2020-05-21  Jonathan Wakely  <jwakely@redhat.com>

            PR libstdc++/93983
            * include/bits/iterator_concepts.h (__detail::__cpp17_iterator):
            Reorder constraints to avoid recursion when constructors use
            iterator_traits (LWG 3420).
            * testsuite/24_iterators/customization_points/lwg3420.cc: New test.

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

* [Bug libstdc++/93983] std::filesystem::path is not concept-friendly
       [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2020-05-21  7:05 ` cvs-commit at gcc dot gnu.org
@ 2020-05-21  7:05 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-21  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |10.2

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 10.2

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

end of thread, other threads:[~2020-05-21  7:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93983-4@http.gcc.gnu.org/bugzilla/>
2020-03-21 14:17 ` [Bug libstdc++/93983] std::filesystem::path is not concept-friendly pacoarjonilla at yahoo dot es
2020-03-21 20:22 ` redi at gcc dot gnu.org
2020-05-12 21:42 ` gcc-bugs at marehr dot dialup.fu-berlin.de
2020-05-12 22:43 ` redi at gcc dot gnu.org
2020-05-21  0:35 ` redi at gcc dot gnu.org
2020-05-21  1:11 ` rs2740 at gmail dot com
2020-05-21  5:57 ` redi at gcc dot gnu.org
2020-05-21  6:31 ` redi at gcc dot gnu.org
2020-05-21  6:39 ` cvs-commit at gcc dot gnu.org
2020-05-21  7:05 ` cvs-commit at gcc dot gnu.org
2020-05-21  7:05 ` 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).