Re: [Cppcms-users] Compilation errors using gcc 4.5 and c++0x
Brought to you by:
artyom-beilis
From: Stanimir M. <sta...@zo...> - 2010-06-26 09:46:20
|
Thanks, I fetched it from svn! Yes, gcc 4.4 and not 4.5 has the auto and some other nice c++0x features. I will switch in a day to 4.5 for more of them. Actually, CppCms compiles fine without the --std=c++0x flag. I saw you are using the auto keyword in the templates loops if available and since I am using it too, decided to give it to CppCms also. About the error, I think that because the 0 (int) argument is an rvalue and converting it to non const pointer (because the return result is non const). On Fri, Jun 25, 2010 at 3:51 PM, Artyom <art...@ya...> wrote: > > Hello, > > Small note - not 4.5 -- 4.4 > > To be honest, it looks like a compiler bug... Or I do not know C++. > The funniest thing that I did tested the code with gcc-4.5 and c++0x flag > and it worked well. (See http://cppcms.sourceforge.net/wikipp/en/page/cppcms_1x_platforms) > > gcc-4.4 (that I fortunately have installed) fails on > > return buffer_data_type(0,0); > > Where buffer_data_type is std:pair of <entry const *,size_t> and entry itself > defined as struct entry { Pointer ptr; size_t size; } where Pointer is template parameters. > > Now gcc-4.4 complains that it can't convert 0 (int) to entry const *, where it is clearly (at least for me) > legal as I can assign 0 to pointer. > > Now I fixed this in the code by creating empty buffer_data_type and manually setting first and second to 0. > > But what I do interested is whether I'm wrong or compiler is wrong. > > I've commited the fix in changeset 1296 > You may take it from the svn or just apply these changes in your copy as shown there: > > http://cppcms.svn.sourceforge.net/viewvc/cppcms/framework/branches/refactoring/booster/booster/aio/buffer.h?r1=1173&r2=1296 > > Thanks for the report, > Artyom > > > > > ----- Original Message ---- > > From: Stanimir Mladenov <sta...@zo...> > > To: cpp...@li... > > Sent: Fri, June 25, 2010 2:28:48 PM > > Subject: [Cppcms-users] Compilation errors using gcc 4.5 and c++0x > > > > Hello Artyom, > > Congratulations for the beta release of CppCms > > 1.x.x! > > I am using the new features of gcc 4.4 and --std=c++0x > > Here > > are some compile errors from it. > > [ 1%] Building CXX > > object > booster/CMakeFiles/booster.dir/lib/aio/src/socket.cpp.o > In file > > included from /usr/include/c++/4.4/bits/stl_algobase.h:66, > > > from > > /usr/include/c++/4.4/bits/char_traits.h:41, > > > from /usr/include/c++/4.4/string:42, > > > from > > /usr/include/c++/4.4/stdexcept:39, > > > > > from > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/function.h:11, > > > > > from > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/socket.h:12, > > > > > from > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/lib/aio/src/socket.cpp:28: > /usr/include/c++/4.4/bits/stl_pair.h: > > In constructor ‘std::pair<_T1, > _T2>::pair(_U1&&, _U2&&) > > [with _U1 = int, _U2 = int, _T1 = > > const > booster::aio::buffer_impl<char*>::entry*, _T2 = unsigned > > int]’: > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:34: > > > instantiated from > > ‘std::pair<const > booster::aio::buffer_impl<Pointer>::entry*, > > unsigned int> > booster::aio::buffer_impl<Pointer>::get() const [with > > Pointer > > = > char*]’ > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:77: > > > instantiated from here > /usr/include/c++/4.4/bits/stl_pair.h:90: error: > > invalid conversion > from ‘int’ to ‘const > > booster::aio::buffer_impl<char*>::entry*’ > /usr/include/c++/4.4/bits/stl_pair.h: > > In constructor ‘std::pair<_T1, > _T2>::pair(_U1&&, _U2&&) > > [with _U1 = int, _U2 = int, _T1 = const > booster::aio::buffer_impl<const > > char*>::entry*, _T2 = unsigned > > int]’: > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:34: > > > instantiated from > > ‘std::pair<const > booster::aio::buffer_impl<Pointer>::entry*, > > unsigned int> > booster::aio::buffer_impl<Pointer>::get() const [with > > Pointer = > > const > char*]’ > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/lib/aio/src/socket.cpp:377: > > > instantiated from here > /usr/include/c++/4.4/bits/stl_pair.h:90: error: > > invalid conversion > from ‘int’ to ‘const booster::aio::buffer_impl<const > > char*>::entry*’ > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/system_error.h: > At > > global > > scope: > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/system_error.h:56: > warning: > > ‘booster::system::posix_category’ defined but not used > make[2]: *** > > [booster/CMakeFiles/booster.dir/lib/aio/src/socket.cpp.o] Error 1 > make[1]: > > *** [booster/CMakeFiles/booster.dir/all] Error 2 > make: *** [all] Error > > 2 > > Greetings, > Stanimir > > ------------------------------------------------------------------------------ > ThinkGeek > > and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. > > ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and > > enter to win: > > > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > Cppcms-users > > mailing list > > > href="mailto:Cpp...@li...">Cpp...@li... > > > href="https://lists.sourceforge.net/lists/listinfo/cppcms-users" target=_blank > > >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |