martinmoene / expected-lite

expected lite - Expected objects in C++11 and later in a single-file header-only library
Boost Software License 1.0
389 stars 35 forks source link

`volatile` type not handled as expected #64

Open Crzyrndm opened 10 months ago

Crzyrndm commented 10 months ago

Somewhere inside the constructor there appears to be missing handling of a type declared as volatile

https://godbolt.org/z/d399qnY64 std::expected from GCC use for comparison

This is a very odd use of volatile (it came up when a colleague used it to defeat the optimiser while debugging) so I really can't be surprised it's a bit iffy

martinmoene commented 10 months ago

it's interesting :)

martinmoene commented 10 months ago

The same has already been taken care of in nonstd::optional, likely via its issue 69.

See the expanded Compiler Explorer snippet.

I'll update nonst::expected likewise.