Opened 6 years ago

Closed 19 months ago

#7423 closed Bugs (fixed)

std::map::erase returns iterator in C++11 mode instead of void, should be handled properly

Reported by: Andrei Elovikov <a.elovikov@…> Owned by: Kohei Takahashi
Milestone: Boost 1.65.0 Component: phoenix
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:


The issue is with the following code: boost/phoenix/stl/container.hpp, line 284

        namespace result_of
            template <typename C, typename Arg1, typename Arg2 = mpl::void_>
            struct erase
                //  BOOST_MSVC #if branch here in map_erase_result non-
                //  standard behavior. The return type should be void but
                //  VC7.1 prefers to return iterator_of<C>. As a result,
                //  VC7.1 complains of error C2562:
                //  boost::phoenix::stl::erase::operator() 'void' function
                //  returning a value. Oh well... :*

                            typename remove_reference<Arg1>::type
                          , typename iterator_of<C>::type
#if defined(BOOST_MSVC)// && (BOOST_MSVC <= 1500)
                      , iterator_of<C>
                      , boost::mpl::identity<void>
                      , size_type_of<C>

                typedef typename
                      , map_erase_result
                      , iterator_of<C>

It seems that MSVC's behaviour becomes the standard one with C++11.

Also the current check seems to be done incorrectly because Intel Compiler uses MSVC's stl library on Windows, so checking for _MSC_VER will be more appropriate, I think.

Change History (2)

comment:1 Changed 19 months ago by Kohei Takahashi

Owner: changed from Thomas Heller to Kohei Takahashi

comment:2 Changed 19 months ago by Kohei Takahashi

Milestone: To Be DeterminedBoost 1.65.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.