This code compiles cleanly and works with all compilers I've tried except for GCC 8 (and current GCC trunk):
std::make_shared<volatile int>(0)
I'd like to know:
- Is GCC 8 correct to refuse this code?
- Is there a substitute that GCC 8 will accept (with the same semantics and performance)? I am aware of
std::atomic
, but the semantics are not the same so suggestions to use it instead ofvolatile
are not what I'm looking for.
See it here: https://godbolt.org/z/rKy3od