Opened 7 years ago
Last modified 5 years ago
#11874 reopened Bugs
Compilation error with GCC4.6 in C++11 mode
Reported by: | Antony Polukhin | Owned by: | Emil Dotchevski |
---|---|---|---|
Milestone: | To Be Determined | Component: | exception |
Version: | Boost 1.64.0 | Severity: | Regression |
Keywords: | c++11 exception type_traits | Cc: |
Description (last modified by )
g++-4.6 -std=c++11
causes compilation error:
../../../boost/exception/info.hpp: In instantiation of ‘boost::error_info<boost::tag_original_exception_type, const std::type_info*>’: ../../../boost/exception/detail/exception_ptr.hpp:95:32: instantiated from here ../../../boost/exception/info.hpp:66:5: error: ‘class boost::error_info<boost::tag_original_exception_type, const std::type_info*>’ has no member named ‘value_’
BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<value_type>::value)
may help.
Change History (31)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
Component: | None → exception |
---|---|
Owner: | set to |
comment:3 by , 6 years ago
comment:6 by , 6 years ago
The problem is that the line numbers have changed and there are two similar lines, currently 60 and 67. The original report refers to value rather than value_, which probably means the error is at what is now line 60, though there may also be an error at line 67.
Maybe you can try the fix suggested in the original report?
comment:7 by , 6 years ago
Here is the compile error I get with 1.62.0 beta 2
/home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of 'boost::error_info<boost::errinfo_errno_, int>': /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/errinfo_errno.hpp:36:16: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: 'class boost::error_info<boost::errinfo_errno_, int>' has no member named 'value_' /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of 'boost::error_info<boost::tag_original_exception_type, const std::type_info*>': /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/detail/exception_ptr.hpp:95:32: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: 'class boost::error_info<boost::tag_original_exception_type, const std::type_info*>' has no member named 'value_' /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of 'boost::error_info<YAPL::yerror_info_string, std::basic_string<char> >': /home/buildhost/delete_me_kratz00/yapl/yapl_linux.cpp:92:91: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: 'class boost::error_info<YAPL::yerror_info_string, std::basic_string<char> >' has no member named 'value_'
Regarding the suggested fix, I am not sure what to do with it.
comment:8 by , 6 years ago
Can you tell me what Exception headers are included in what order in yapl_linux.cpp?
comment:9 by , 6 years ago
Sure, here is the full trace:
[ 8%] Building CXX object yapl/CMakeFiles/yapl.dir/yapl_linux.cpp.o In file included from /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/diagnostic_information.hpp:17:0, from /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/all.hpp:15, from /home/buildhost/delete_me_kratz00/yapl/yapl.h:7, from /home/buildhost/delete_me_kratz00/yapl/yapl_linux.h:5, from /home/buildhost/delete_me_kratz00/yapl/yapl_linux.cpp:1: /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of ‘boost::error_info<boost::errinfo_errno_, int>’: /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/errinfo_errno.hpp:36:16: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: ‘class boost::error_info<boost::errinfo_errno_, int>’ has no member named ‘value_’ /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of ‘boost::error_info<boost::tag_original_exception_type, const std::type_info*>’: /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/detail/exception_ptr.hpp:95:32: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: ‘class boost::error_info<boost::tag_original_exception_type, const std::type_info*>’ has no member named ‘value_’ /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of ‘boost::error_info<YAPL::yerror_info_string, std::basic_string<char> >’: /home/buildhost/delete_me_kratz00/yapl/yapl_linux.cpp:92:91: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: ‘class boost::error_info<YAPL::yerror_info_string, std::basic_string<char> >’ has no member named ‘value_’ make[2]: *** [yapl/CMakeFiles/yapl.dir/yapl_linux.cpp.o] Error 1 make[1]: *** [yapl/CMakeFiles/yapl.dir/all] Error 2 make: *** [all] Error 2
comment:10 by , 6 years ago
I did not expect it to work, but I just tested boost 1.62 anyway. No suprise, the error still exists and the trace looks the same:
[ 16%] Building CXX object yapl/CMakeFiles/yapl.dir/yapl_linux.cpp.o In file included from /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/diagnostic_information.hpp:17:0, from /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/all.hpp:15, from /home/buildhost/delete_me_kratz00/yapl/yapl.h:7, from /home/buildhost/delete_me_kratz00/yapl/yapl_linux.h:5, from /home/buildhost/delete_me_kratz00/yapl/yapl_linux.cpp:1: /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of ‘boost::error_info<boost::errinfo_errno_, int>’: /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/errinfo_errno.hpp:36:16: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: ‘class boost::error_info<boost::errinfo_errno_, int>’ has no member named ‘value_’ /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of ‘boost::error_info<boost::tag_original_exception_type, const std::type_info*>’: /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/detail/exception_ptr.hpp:95:32: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: ‘class boost::error_info<boost::tag_original_exception_type, const std::type_info*>’ has no member named ‘value_’ /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of ‘boost::error_info<YAPL::yerror_info_string, std::basic_string<char> >’: /home/buildhost/delete_me_kratz00/yapl/yapl_linux.cpp:92:91: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: ‘class boost::error_info<YAPL::yerror_info_string, std::basic_string<char> >’ has no member named ‘value_’ make[2]: *** [yapl/CMakeFiles/yapl.dir/yapl_linux.cpp.o] Error 1 make[1]: *** [yapl/CMakeFiles/yapl.dir/all] Error 2 make: *** [all] Error 2
comment:12 by , 6 years ago
I just looked at it again, I can't quite make sense of it. The definition of the error_info template does have a member named 'value_'. That template will be defined if you include info.hpp, but it is declared and left incomplete if you only include error_info.hpp. Is it possible that the error you're getting is because in this context info.hpp hasn't been included?
comment:13 by , 6 years ago
Thanks Emil for looking into this.
This is test code (test.cpp), which reproduces the error:
#include <string> #include <boost/exception/error_info.hpp> #include <boost/exception/exception.hpp> #include <boost/exception/info.hpp> struct MyException: virtual boost::exception {}; typedef boost::error_info<struct error_info_string, std::string> errorInfoString; int main(void) { throw MyException() << errorInfoString("doh"); return 0; }
g++ -std=c++0x -I/home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include test.cpp
In file included from test.cpp:4:0: /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp: In instantiation of ‘boost::error_info<error_info_string, std::basic_string<char> >’: test.cpp:10:49: instantiated from here /home/buildhost/delete_me_kratz00/yapl/test/3rd-party-libraries/library-boost/i386-linux-gnu/include/boost/exception/info.hpp:66:5: error: ‘class boost::error_info<error_info_string, std::basic_string<char> >’ has no member named ‘value_’
comment:14 by , 6 years ago
Can you please try with latest develop branch? There was a bug where some types were defined as struct in one place and as class in another, and that's fixed now. With latest develop, I get no error with gcc 4.8.5.
comment:15 by , 6 years ago
Hi Emil
I've tested the develop branch: the result stays the same :(
Do you by any chance have access to an Ubuntu 12.04 system? As such a system has the compiler in question.
comment:16 by , 6 years ago
#include <iostream> #include <boost/algorithm/hex.hpp> int main(void) { std::cout << boost::algorithm::hex(std::string("hi")) << "\n"; return 0; }
/deps/boost_1_62_0/boost/exception/info.hpp: In instantiation of ‘boost::error_info<boost::algorithm::bad_char_, char>’: /deps/boost_1_62_0/boost/algorithm/hex.hpp:75:14: instantiated from here /deps/boost_1_62_0/boost/exception/info.hpp:66:5: error: ‘class boost::error_info<boost::algorithm::bad_char_, char>’ has no member named ‘value_’
# g++ -v 2>&1 | grep version gcc version 4.6.3 (GCC)
comment:17 by , 6 years ago
boost/exception/exception.hpp contains specialization for error_info with member v_ instead value_
comment:18 by , 6 years ago
I just gave boost 1.63 a spin, as expected, the error is still there. The error is exactly the same as before.
comment:19 by , 6 years ago
Can you confirm that the error_info_basic_test.cpp I added is equivalent to the one that issues the error for you? It succeeds for me under gcc-4.6.3, see https://travis-ci.org/boostorg/exception/jobs/188456592
comment:20 by , 6 years ago
With error_info_basic_test.cpp I get the same error, as with my test code. I think what you are missing in your travis build is the compiler flag ("-std=c++0x") and that is the reason it succeeds.
comment:22 by , 6 years ago
This isn't fixed. Boost 1.6.3, gcc 4.6.3 with flag -std=gnu++0x on Ubuntu 12.04.5. Same problem as above.
follow-up: 25 comment:23 by , 6 years ago
Please see https://travis-ci.org/boostorg/exception/jobs/203665051, notice CXXSTD=c++0x and the output of g++ --version:
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Am I missing something?
comment:24 by , 6 years ago
Hi Emil
I was just testing version 1.64.0 beta 1 and I could still reproduce this bug. Did the fix not make it in the beta?
comment:25 by , 5 years ago
Replying to Emil Dotchevski:
Please see https://travis-ci.org/boostorg/exception/jobs/203665051, notice CXXSTD=c++0x and the output of g++ --version:
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Am I missing something?
Yes. Building the boost libs as you did is no problem.
The easiest way to reproduce the problem (gcc-4.6.4, c++0x mode, boost 1.64):
#include <boost/thread.hpp> int main() { }
Compiling results in:
/opt/wandbox/boost-1.64.0/gcc-4.6.4/include/boost/exception/info.hpp:66:5: error: 'class boost::error_info<boost::tag_original_exception_type, const std::type_info*>' has no member named 'value_'
comment:26 by , 5 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Version: | Boost 1.60.0 → Boost 1.64.0 |
Compiling
#include <boost/thread.hpp>
will fail with gcc-4.6.4, c++0x and boost-1.64:
boost-1.64.0/gcc-4.6.4/include/boost/exception/info.hpp:66:5: error: 'class boost::error_info<boost::tag_original_exception_type, const std::type_info*>' has no member named 'value_'
(It used to work with boost 1.57, other versions not tested)
follow-up: 29 comment:28 by , 5 years ago
Had same issue, but can confirm it does compile on the develop branch - not surprising because the code (error_info_impl.hpp) is guarded with:
#if (__GNUC__*100+__GNUC_MINOR__!=406) //workaround for g++ bug
We found that boost::thread fails to compile with the 1.64.0 release.
Compiler call (with -d2):
(Our user-config.jam points to g++4.6.4 with -std=c++0x).
./b2 --user-config=./user-config.jam toolset=gcc-std0x link=static -q -d2 --with-thread
gcc.compile.c++ bin.v2/libs/thread/build/gcc-std0x/release/link-static/threading-multi/pthread/thread.o "g++" -ftemplate-depth-128 -std=c++0x -O3 -finline-functions -Wno-inline -Wall -pedantic -pthread -m64 -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2/libs/thread/build/gcc-std0x/release/link-static/threading-multi/pthread/thread.o" "libs/thread/src/pthread/thread.cpp" In file included from ./boost/config.hpp:61:0, from ./boost/thread/detail/config.hpp:11, from libs/thread/src/pthread/thread.cpp:9: ./boost/exception/info.hpp:67:42: error: declaration of ‘boost::error_info<Tag, T>::error_info(boost::error_info<Tag, T>&&) noexcept (noexcept ((boost::error_info<Tag, T>::value_type)(std::move(boost::error_info<Tag, T>::x.value_))))’ has a different exception specifier error_info( error_info<Tag,T> && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(error_info<Tag,T>::x.value_)))): ^ In file included from ./boost/exception/info.hpp:17:0, from ./boost/exception/detail/exception_ptr.hpp:20, from ./boost/exception_ptr.hpp:9, from ./boost/thread/exceptional_ptr.hpp:10, from ./boost/thread/future.hpp:25, from libs/thread/src/pthread/thread.cpp:19: ./boost/exception/detail/error_info_impl.hpp:54:9: error: from previous declaration ‘boost::error_info<Tag, T>::error_info(boost::error_info<Tag, T>&&) noexcept (noexcept ((boost::error_info<Tag, T>::value_type)(std::move(x.value_))))’ error_info( error_info<Tag,T> && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.value_)))); ^
comment:29 by , 5 years ago
Gah...this time I'll copy-paste the genuine error, and not my test code:
gcc.compile.c++ bin.v2/libs/context/build/gcc-std0x/release/link-static/threading-multi/posix/stack_traits.o "g++" -ftemplate-depth-128 -std=c++0x -O3 -finline-functions -Wno-inline -Wall -pthread -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_CONTEXT_SOURCE -DBOOST_DISABLE_ASSERTS -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DNDEBUG -I"." -c -o "bin.v2/libs/context/build/gcc-std0x/release/link-static/threading-multi/posix/stack_traits.o" "libs/context/src/posix/stack_traits.cpp" In file included from ./boost/exception/detail/exception_ptr.hpp:20:0, from ./boost/exception_ptr.hpp:9, from ./boost/thread/exceptional_ptr.hpp:10, from ./boost/thread/future.hpp:25, from ./boost/thread.hpp:24, from libs/context/src/posix/stack_traits.cpp:24: ./boost/exception/info.hpp: In instantiation of 'boost::error_info<boost::tag_original_exception_type, const std::type_info*>': ./boost/exception/detail/exception_ptr.hpp:95:32: instantiated from here ./boost/exception/info.hpp:66:5: error: 'class boost::error_info<boost::tag_original_exception_type, const std::type_info*>' has no member named 'value_' ...failed gcc.compile.c++ bin.v2/libs/context/build/gcc-std0x/release/link-static/threading-multi/posix/stack_traits.o... gcc.compile.c++ bin.v2/libs/thread/build/gcc-std0x/release/link-static/threading-multi/pthread/thread.o "g++" -ftemplate-depth-128 -std=c++0x -O3 -finline-functions -Wno-inline -Wall -pedantic -pthread -m64 -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2/libs/thread/build/gcc-std0x/release/link-static/threading-multi/pthread/thread.o" "libs/thread/src/pthread/thread.cpp" In file included from ./boost/exception/detail/exception_ptr.hpp:20:0, from ./boost/exception_ptr.hpp:9, from ./boost/thread/exceptional_ptr.hpp:10, from ./boost/thread/future.hpp:25, from libs/thread/src/pthread/thread.cpp:19: ./boost/exception/info.hpp: In instantiation of 'boost::error_info<boost::tag_original_exception_type, const std::type_info*>': ./boost/exception/detail/exception_ptr.hpp:95:32: instantiated from here ./boost/exception/info.hpp:66:5: error: 'class boost::error_info<boost::tag_original_exception_type, const std::type_info*>' has no member named 'value_'
comment:30 by , 5 years ago
Looks like a fix for this ticket has made it into the Boost 1.65.0 beta 1 release, at least my code works with this version.
Thanks.
comment:31 by , 5 years ago
Like the beta, the final 1.65.0 release fixes the reported problem for me. I think this ticket can be closed now.
I was just testing 1.62.0 beta 2 and ran into this issue.
Used compiler: g++ (Ubuntu/Linaro? 4.6.3-1ubuntu5) 4.6.3
Boost build commands:
With the same settings etc. I can successfully compile and run my code with Boost 1.59.0.
Let me know if you need more information to reproduce and fix this error.