Opened 7 years ago
Closed 6 years ago
#12052 closed Bugs (worksforme)
Boost 1.60 any.hpp error: 'if_' in namespace 'boost::mpl' does not name a template type
Reported by: | Owned by: | Antony Polukhin | |
---|---|---|---|
Milestone: | To Be Determined | Component: | any |
Version: | Boost 1.60.0 | Severity: | Problem |
Keywords: | any.hpp | Cc: |
Description
Linux 3.19.0-51-generic #58-Ubuntu SMP Fri Feb 26 21:22:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Ubuntu 15.04
Boost 1.60
#include <iostream> #include <boost/any.hpp>
int main() {
boost::any a = 1; std::cout << boost::any_cast<int>(a) << '\n'; a = 3.14; std::cout << boost::any_cast<double>(a) << '\n'; a = true; std::cout << std::boolalpha << boost::any_cast<bool>(a) << '\n';
}
This code generates a compilation error:
/usr/include/boost/any.hpp: In function ‘ValueType boost::any_cast(boost::any&)’: /usr/include/boost/any.hpp:292:52: error: ‘if_’ in namespace ‘boost::mpl’ does not name a template type
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
/usr/include/boost/any.hpp:292:55: error: expected unqualified-id before ‘<’ token
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
/usr/include/boost/any.hpp:298:28: error: ‘ref_type’ does not name a type
return static_cast<ref_type>(*result);
Change History (4)
comment:1 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 6 years ago
Status: | assigned → new |
---|
comment:3 by , 6 years ago
A similar bug exists in classic_utility.hpp
(resp. boost/spirit/home/classic/utility.hpp), which also fails to include
if.hpp`.
Checking for header boost/spirit/include/classic_utility.hpp ==> #include <boost/spirit/include/classic_utility.hpp> int main(int argc, char **argv) { (void)argc; (void)argv; return 0; } <== [1/2] Compiling ESC[32mbuild/.conf_check_f294e83272b96d2356ef0156052d5b3c/test.cppESC[0m ['/usr/lib/ccache/bin/g++', '-std=c++11', '-march=x86-64', '-mtune=generic', '-O2', '-pipe', '-fstack-protector', '-D_FORTIFY_SOURCE=2', '-DVERSION="1.0.0"', '-DHAVE_BOOST_SPIRIT_INCLUDE_CLASSIC_DYNAMIC_HPP=1', '-DHAVE_BOOST_SPIRIT_INCLUDE_CLASSIC_CORE_HPP=1', '-DHAVE_BOOST_SPIRIT_INCLUDE_CLASSIC_PARSE_TREE_HPP=1', '../test.cpp', '-c', '-o', '/home/chris/src/arch/aur/ttl2c-git/src/ttl2c/build/.conf_check_f294e83272b96d2356ef0156052d5b3c/testbuild/test.cpp.1.o'] err: In file included from /usr/include/boost/spirit/home/classic/utility.hpp:30:0, from /usr/include/boost/spirit/include/classic_utility.hpp:11, from ../test.cpp:1: /usr/include/boost/spirit/home/classic/utility/loops.hpp:269:35: error: 'if_' in namespace 'boost::mpl' does not name a template type typedef typename mpl::if_< ^~~ /usr/include/boost/spirit/home/classic/utility/loops.hpp:269:38: error: expected unqualified-id before '<' token typedef typename mpl::if_< ^
comment:4 by , 6 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Added a test in c8a2c96a. The issue is not reproducable.
Looks like this was fixed in ed7cac4e. Are you sure that Boost. 1.60 is used on your system? Does the fix line exist in your header?