Opened 9 years ago
Closed 8 years ago
#9418 closed Bugs (fixed)
key of fusion map could not be abstract type
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | fusion |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The following code fails to be compiled with Boost 1.55.0 using gcc 4.8.1. But work with Boost 1.53.0 using gcc 4.8.1.
#include <boost/fusion/include/map.hpp> #include <boost/fusion/include/pair.hpp> namespace bf = boost::fusion; struct tagging { virtual void foo() = 0; }; int main() { bf::map<bf::pair<tagging, int>> booom; return 0; }
gcc complains with the following
In file included from /usr/local/include/boost/fusion/container/map/map_fwd.hpp:24:0, from /usr/local/include/boost/fusion/container/map/map.hpp:10, from /usr/local/include/boost/fusion/container/map.hpp:10, from /usr/local/include/boost/fusion/include/map.hpp:10, from main.cpp:1: /usr/local/include/boost/fusion/container/map/detail/map_impl.hpp: In instantiation of ‘struct boost::fusion::detail::map_impl<0, boost::fusion::pair<tagging, int> >’: /usr/local/include/boost/fusion/container/map/map.hpp:45:12: required from ‘struct boost::fusion::map<boost::fusion::pair<tagging, int> >’ main.cpp:13:37: required from here /usr/local/include/boost/fusion/container/map/detail/map_impl.hpp:116:18: error: cannot allocate an object of abstract type ‘tagging’ key_type get_key(mpl::int_<index>); ^ main.cpp:6:8: note: because the following virtual functions are pure within ‘tagging’: struct tagging ^ main.cpp:8:18: note: virtual void tagging::foo() virtual void foo() = 0; ^ In file included from /usr/local/include/boost/fusion/container/map/map_fwd.hpp:24:0, from /usr/local/include/boost/fusion/container/map/map.hpp:10, from /usr/local/include/boost/fusion/container/map.hpp:10, from /usr/local/include/boost/fusion/include/map.hpp:10, from main.cpp:1: /usr/local/include/boost/fusion/container/map/detail/map_impl.hpp:117:18: error: cannot allocate an object of abstract type ‘tagging’ key_type get_key(mpl::int_<index>) const; ^ main.cpp:6:8: note: since type ‘tagging’ has pure virtual functions struct tagging ^
I guess the failure is caused by the return value of 'get_key' in 'map_impl'.
Change History (2)
comment:1 by , 9 years ago
Component: | function → fusion |
---|---|
Owner: | changed from | to
comment:2 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.