Modify

Opened 5 years ago

Closed 4 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:

Description

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... :*

                typedef
                    boost::mpl::eval_if_c<
                        boost::is_same<
                            typename remove_reference<Arg1>::type
                          , typename iterator_of<C>::type
                        >::value
#if defined(BOOST_MSVC)// && (BOOST_MSVC <= 1500)
                      , iterator_of<C>
#else
                      , boost::mpl::identity<void>
#endif
                      , size_type_of<C>
                    >
                map_erase_result;

                typedef typename
                    boost::mpl::eval_if_c<
                        has_mapped_type<C>::value
                      , map_erase_result
                      , iterator_of<C>
                    >::type
                type;
            };
        }

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.

Attachments (0)

Change History (2)

comment:1 Changed 5 months ago by Kohei Takahashi

Owner: changed from Thomas Heller to Kohei Takahashi

comment:2 Changed 4 months ago by Kohei Takahashi

Milestone: To Be DeterminedBoost 1.65.0
Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Kohei Takahashi.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.