You are not logged in.
Hi,
gcc 4.8 was "in my system update" today and after the upgrade the compilation of my C++ project fails. I'm a bit puzzled about the issues since I'm using clang for compiling the code, but however the errors point to gcc. For example:
./core/PacketTrap.cpp:21:18: error: no viable overloaded '='
for (iterator=trappedPackets.begin(); iterator!=trappedPackets.end(); iterator++) {
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/hashtable_policy.h:231:12: note: candidate function (the implicit copy assignment operator) not viable: no known conversion
from '_Node_iterator<[2 * ...], 1>' to '_Node_iterator<[2 * ...], 0>' for 1st argument
struct _Node_iterator
^
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/hashtable_policy.h:231:12: note: candidate function (the implicit move assignment operator) not viable: no known conversion
from '_Node_iterator<[2 * ...], 1>' to '_Node_iterator<[2 * ...], 0>' for 1st argument
struct _Node_iterator
^
./core/PacketTrap.cpp:21:51: error: invalid operands to binary expression ('unordered_map<AddressPtr, PacketSet *>::iterator' (aka '_Node_iterator<value_type, __constant_iterators::value,
__hash_cached::value>') and 'iterator' (aka '_Node_iterator<value_type, __constant_iterators::value, __hash_cached::value>'))
for (iterator=trappedPackets.begin(); iterator!=trappedPackets.end(); iterator++) {
~~~~~~~~^ ~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_pair.h:227:5: note: candidate template ignored: failed template argument deduction
operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_iterator.h:303:5: note: candidate template ignored: failed template argument deduction
operator!=(const reverse_iterator<_Iterator>& __x,
^
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_iterator.h:353:5: note: candidate template ignored: failed template argument deduction
operator!=(const reverse_iterator<_IteratorL>& __x,
^
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_iterator.h:817:5: note: candidate template ignored: failed template argument deduction
operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
And this goes on and on. Maybe somebody can give me a hint which has changed most recently and why somehow it is not possible to deduct the type in the containers I'm using (at least that seems to be the problem). Also, why is it using code in gcc 4.8 - somehow I was expecting that clang uses the libstdc++ code.
Thanks in advance!
Best regards,
Michael
P.S.: I can give you the link to the github repository. However, this seems to be a compiler issue and not a code issue (since it worked before and something is messed up).
Last edited by ridcully (2013-04-28 07:13:32)
Offline
P.S.: I can give you the link to the github repository. However, this seems to be a compiler issue and not a code issue (since it worked before and something is messed up).
Without a link to the code, this is merely a guessing game.
Offline
ridcully wrote:P.S.: I can give you the link to the github repository. However, this seems to be a compiler issue and not a code issue (since it worked before and something is messed up).
Without a link to the code, this is merely a guessing game.
I don't think that is really "related" to the code since it compiles fine at my workstation at home (here, it is gcc 4.7.2, clang 3.2). However, here is the link to the code:
https://github.com/des-testbed/Ara-Sim/ … etTrap.cpp
I strongly advice you not to checkout and try to compile it since it requires OMNeT++ (a network simulator (in AUR)) and the INETMANET package (which is a submodule) to the projects repository.
Offline
Looks like you should be using a
std::unordered_map<std::shared_ptr<Address>, std::unordered_set<Packet*, PacketHash, PacketPredicate>*, AddressHash, AddressPredicate>::iterator
not a
std::unordered_map<std::shared_ptr<Address>, std::unordered_set<Packet*, PacketHash, PacketPredicate>*>::iterator
Last edited by tavianator (2013-04-07 20:43:53)
Offline
I don't think that is really "related" to the code since it compiles fine at my workstation at home (here, it is gcc 4.7.2, clang 3.2).
If I had a dollar every time I heard a similar statement I'd... well, I'd have less than a hundred dollars, sure.
For something as straightforward as iterators, I'd be very very very surprised if it was a GCC bug. Suspect your code first, always.
Offline
Looks like you should be using a
std::unordered_map<std::shared_ptr<Address>, std::unordered_set<Packet*, PacketHash, PacketPredicate>*, AddressHash, AddressPredicate>::iterator
not a
std::unordered_map<std::shared_ptr<Address>, std::unordered_set<Packet*, PacketHash, PacketPredicate>*>::iterator
Okay, that was actually the "problem". Thank you very much for your help. However, I still don't understand why this was not an issue with gcc<=4.8.
If I had a dollar every time I heard a similar statement I'd... well, I'd have less than a hundred dollars, sure.
You are absolutely right, but if the code works on every machine which has an older version of gcc/clang and breaks on every machine with the current version you suspect that there is at least a change in the "evaluation" of the code.
Offline
Probably because gcc (actually libstdc++, the gcc implementation of the STL) had a bug which is now fixed.
Offline