This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/60689] New: Bogus error with atomic::exchange
- From: "roman at binarylife dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 27 Mar 2014 19:33:02 +0000
- Subject: [Bug c++/60689] New: Bogus error with atomic::exchange
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60689
Bug ID: 60689
Summary: Bogus error with atomic::exchange
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: roman at binarylife dot net
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
$ cat test.cc
#include <atomic>
template<int N>
struct X { char stuff[N]; };
template<int N>
void test() {
X<N> x;
std::atomic<X<N>> a;
x = a;
a.exchange(x);
}
int main() {
test<9>();
return 0;
}
$ g++ -std=c++11 -O2 -l atomic test.cc
In file included from test.cc:1:0:
/home/abend/local/gcc-4.9/include/c++/4.9.0/atomic: In instantiation of â_Tp
std::atomic<_Tp>::exchange(_Tp, std::memory_order) [with _Tp = X<9>;
std::memory_order = std::memory_order]â:
test.cc:11:3: required from âvoid test() [with int N = 9]â
test.cc:15:11: required from here
/home/abend/local/gcc-4.9/include/c++/4.9.0/atomic:225:41: error: invalid
conversion from âX<9>*â to âlong unsigned intâ [-fpermissive]
__atomic_exchange(&_M_i, &__i, &tmp, _m);
^
/home/abend/local/gcc-4.9/include/c++/4.9.0/atomic:225:41: error: cannot
convert âstd::memory_orderâ to âvoid*â for argument â4â to âvoid
__atomic_exchange(long unsigned int, volatile void*, void*, void*, int)â
$ g++ --version
g++ (GCC) 4.9.0 20140327 (experimental)
...