Skip to content

std::filesystem::directory_iterator code compiles OK with <filesytem> fails with std module, 17.5 Preview 2  #3330

Description

The following code compiles OK when using the <filesystem> header but fails when using import std;. This is with 17.5 Preview 2. The only changes to a default C++ project in VS was /std:c++latest and adding the std.ixx file

import std;

// #include <filesystem>

int main( )
{
    for (auto a : std::filesystem::directory_iterator( "C:\\" )) { }

    return 0;
}

The error message when using the std module is

1>C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\type_traits(2102,13): error C2678: binary '&': no operator found which takes a left-hand operand of type '_Bitmask' (or there is no acceptable conversion)
1>        with
1>        [
1>            _Bitmask=__std_fs_file_attr
1>        ]
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\cstddef(49,39): message : could be 'std::byte std::operator &(const std::byte,const std::byte) noexcept'
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\type_traits(2102,13): message : while trying to match the argument list '(_Bitmask, _Bitmask)'
1>        with
1>        [
1>            _Bitmask=__std_fs_file_attr
1>        ]
1>C:\Users\david\devel\bugs\mudule_filesystem\Project1\Test.cpp(10,1): message : see reference to function template instantiation 'bool std::_Bitmask_includes_any<__std_fs_file_attr>(_Bitmask,_Bitmask) noexcept' being compiled
1>        with
1>        [
1>            _Bitmask=__std_fs_file_attr
1>        ]
1>Done building project "Project1.vcxproj" -- FAILED.

Which seemed really odd to me.

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!modulesC++23 modules, C++20 header units

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions