Skip to content

<filesystem>: path's comparison operators are IF-NDR #2358

Description

@statementreply

Describe the bug

After #2000, path's comparison operators are IF-NDR (ill-formed, no diagnostic required). See Arthur O'Dwyer (@Quuxplusone)'s blogpost and Jonathan Wakely (@jwakely)'s comment for a detailed analysis of similar issues in libc++ and libstdc++.

Command-line test case

Copied from Arthur O’Dwyer's blogpost.

D:\Temp>type repro.cpp
#include <filesystem>
#include <ranges>

static_assert(std::ranges::range<std::filesystem::path>);
static_assert(std::ranges::range<const std::filesystem::path>);
D:\Temp>clang-cl /c /EHsc /W4 /std:c++latest /D_HAS_CXX23=1 repro.cpp
repro.cpp(5,1): error: static_assert failed
static_assert(std::ranges::range<const std::filesystem::path>);
^                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
repro.cpp(5,28): note: because 'const std::filesystem::path' does not satisfy 'range'
static_assert(std::ranges::range<const std::filesystem::path>);
                           ^
D:\repos\STL\out\\build\x64\out\inc\xutility(2233,9): note: because '::std::ranges::begin(__r)' would be invalid: no
      matching function for call to object of type 'const _Begin::_Cpo'
        _RANGES begin(__r);
        ^
D:\repos\STL\out\\build\x64\out\inc\yvals_core.h(1411,20): note: expanded from macro '_RANGES'
#define _RANGES    ::std::ranges::
                   ^
1 error generated.

STL version

3c2fd04

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions