[Bug libstdc++/93983] std::filesystem::path is not concept-friendly

barry.revzin at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Feb 29 19:04:00 GMT 2020


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

Barry Revzin <barry.revzin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |barry.revzin at gmail dot com

--- Comment #1 from Barry Revzin <barry.revzin at gmail dot com> ---
Here's a shorter reproduction without filesystem:

#include <concepts>
#include <iterator>

struct path {
    template <typename Source,
        typename = std::enable_if_t<
            std::is_same_v<
                std::iterator_traits<Source>::value_type,
                char>>
        >
    path(Source const&);
};

struct Bar
{
    Bar(const path& p);
};

#ifdef ADD_THIS
static_assert(!std::constructible_from<path, Bar>);
#endif
static_assert(std::copyable<Bar>);

If ADD_THIS isn't defined, the copyable check is a hard error. If it is
defined, compiles fine.

https://godbolt.org/z/FEoiwA


More information about the Gcc-bugs mailing list