Opened 5 years ago
Closed 5 years ago
#13037 closed Bugs (fixed)
<boost/variant/polymorphic_get.hpp> is missing include <boost/type_traits/is_const.hpp>
Reported by: | Owned by: | Antony Polukhin | |
---|---|---|---|
Milestone: | Boost 1.65.0 | Component: | variant |
Version: | Boost 1.64.0 | Severity: | Problem |
Keywords: | variant | Cc: |
Description
Trivial demonstration can be made by preparing a source file containing nothing but an inclusion of the polymorphic_get.hpp
:
#include <boost/variant/polymorphic_get.hpp>
on GCC 6.3 with options -Wall -Wextra -std=c++14
compiling such file produces errors:
In file included from Test.cpp:1:0: /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp: In member function ‘boost::detail::variant::get_polymorphic_visitor<Base>::pointer boost::detail::variant::get_polymorphic_visitor<Base>::operator()(U&) const’: /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:121:18: error: ‘is_const’ is not a member of ‘boost’ (boost::is_const<base_t>::value || !boost::is_const<U>::value) ^~~~~ /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:121:18: note: suggested alternative: In file included from /usr/lib/gcc/x86_64-pc-cygwin/6.3.0/include/c++/bits/move.h:57:0, from /usr/lib/gcc/x86_64-pc-cygwin/6.3.0/include/c++/bits/nested_exception.h:40, from /usr/lib/gcc/x86_64-pc-cygwin/6.3.0/include/c++/exception:171, from /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:15, from Test.cpp:1: /usr/lib/gcc/x86_64-pc-cygwin/6.3.0/include/c++/type_traits:652:12: note: ‘std::is_const’ struct is_const ^~~~~~~~ In file included from Test.cpp:1:0: /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:121:41: error: ‘::value’ has not been declared (boost::is_const<base_t>::value || !boost::is_const<U>::value) ^~ /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:121:53: error: ‘is_const’ is not a member of ‘boost’ (boost::is_const<base_t>::value || !boost::is_const<U>::value) ^~~~~ /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:121:53: note: suggested alternative: In file included from /usr/lib/gcc/x86_64-pc-cygwin/6.3.0/include/c++/bits/move.h:57:0, from /usr/lib/gcc/x86_64-pc-cygwin/6.3.0/include/c++/bits/nested_exception.h:40, from /usr/lib/gcc/x86_64-pc-cygwin/6.3.0/include/c++/exception:171, from /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:15, from Test.cpp:1: /usr/lib/gcc/x86_64-pc-cygwin/6.3.0/include/c++/type_traits:652:12: note: ‘std::is_const’ struct is_const ^~~~~~~~ In file included from Test.cpp:1:0: /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:121:68: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] (boost::is_const<base_t>::value || !boost::is_const<U>::value) ^ /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:121:71: error: ‘::value’ has not been declared (boost::is_const<base_t>::value || !boost::is_const<U>::value) ^~ /cygdrive/c/Programming/boost_1_64_0/boost/variant/polymorphic_get.hpp:125:9: error: template argument 2 is invalid > tag_t; ^
Workaround it trivial - one needs to include is_const.hpp
before including polymorphic_get.hpp
:
#include <boost/type_traits/is_const.hpp> #include <boost/variant/polymorphic_get.hpp>
Change History (4)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Note however that it seems polymorphic_get.hpp
header has more such issues: use of elements that are not directly included. Among others there is boost::remove_cv
- a problem mentioned in ticket #11283.
Should they be solved as well?
At least as for now they are not causing compilation errors.
comment:3 by , 5 years ago
Milestone: | To Be Determined → Boost 1.65.0 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:4 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I have prepared correction for this bug and issues a pull request with it (https://github.com/boostorg/variant/pull/32).