Skip to content

cast bug #23

@skaller

Description

@skaller

~/felix>clang++ -std=c++11 -I. ccx.cpp
In file included from ccx.cpp:2:
./concurrentqueue.hpp:1508:78: error: reinterpret_cast from 'const char ' to 'int *'
casts away qualifiers
...idx) const MOODYCAMEL_NOEXCEPT { return reinterpret_cast<T
>(elements) + static_c...
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ccx.cpp:3:28: note: in instantiation of member function 'moodycamel::ConcurrentQueue<int,
moodycamel::ConcurrentQueueDefaultTraits>::Block::operator[]' requested here
template class moodycamel::ConcurrentQueue;

This is a stupidity in C++, you'll have to work around it.
reinterpret cast isn't allowed to cast away const.

The fix is simple: use an ordinary C cast: (T*) instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions