Thanks to visit codestin.com
Credit goes to github.com

Skip to content

<ios>: std::ios_base::openmode is not a bitmask type #3401

@neilstephens

Description

@neilstephens

Describe the bug
std::ios_base::openmode is not implemented as a bitmask type, therefore, for example, |= operator usage fails to compile.

Command-line test case

C:\Temp>type example.cpp
#include <ios>

int main()
{
    auto open_flags = std::ios::binary;
    open_flags |= std::ios::app;

    return 0;
}

C:\Temp>cl -std:c++17 .\example.cpp

example.cpp
<source>(6): error C2678: binary '|=': no operator found which takes a left-hand operand of type 'std::_Iosb<int>::_Openmode' (or there is no acceptable conversion)
C:/data/msvc/14.21.27702.2/include\cstddef(70): note: could be 'std::byte &std::operator |=(std::byte &,const std::byte) noexcept' [found using argument-dependent lookup]
<source>(6): note: while trying to match the argument list '(std::_Iosb<int>::_Openmode, const std::_Iosb<int>::_Openmode)'
Compiler returned: 2

Expected behavior
compile successfully

STL version
Microsoft (R) C/C++ Optimizing Compiler Version 19.21.27702.2 for x64

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