Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cast bug #23

Closed
skaller opened this issue Jul 26, 2015 · 1 comment
Closed

cast bug #23

skaller opened this issue Jul 26, 2015 · 1 comment
Labels

Comments

@skaller
Copy link

skaller commented Jul 26, 2015

~/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.

@cameron314
Copy link
Owner

Actually, there's no reason for me to be casting away the const at all. Looks like a copy-paste error. Oops!

Good catch, thanks. Should now be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants