Issue 149686
Summary std::atomic_ref broken with const
Labels new issue
Assignees
Reporter jodyhagins
    std::atomic_ref::load() should work with a const value.

The following code should compile.

```c++
#include <atomic>
int main()
{
    int const x = 10;
    return std::atomic_ref(x).load();
}
```

This is not a shallow const issue, but an implementation bug, where the exact type of the value is used rather than removing the cv qualifiers before calling `__atomic_load`.  This seems reasonable from the specification, the fact that load() is const for std::atomic, and the above code compiles if we use libstdc++ with clang, gcc, icc, or msvc.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to