Skip to content

<string>: cannot be constructed from a volatile char array using the from_range constructor #5402

Description

@hewillk
#include <ranges>

volatile char vs[42] = {};
std::string s1(std::begin(vs), std::end(vs));              // ok
std::string s2(std::from_range, vs | std::views::reverse); // ok
std::string s3(std::from_range, vs);                       // not ok

https://godbolt.org/z/vqqEP4c86
s3 should not be rejected, but MSV-STL expected the char array not to be volatile, leading to a hard error in the function body.

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!rangesC++20/23 ranges

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions