boostorg / move

Boost.org move module
http://boost.org/libs/move
Boost Software License 1.0
19 stars 55 forks source link

Avoided GCC 4.9 regression in C++14 mode #4

Closed Flast closed 9 years ago

Flast commented 9 years ago

GCC 4.9.0 and 4.9.1 have a regression: don't compile parenthesized return stmt in C++14 mode.

movable f()
{
    movable m;
    return (m); // bug on here
}

This PR will fix BP x86_64 C++11 - move - doc_move_return / gcc-4.9.1~c14, and other test failures.

For more details, see: https://gcc.gnu.org/PR63437 .

igaztanaga commented 9 years ago

Wouldn't this disallow Named Return Optimization for C++14 in GCC 4.9? I have no access to this compiler but maybe replacing:

define BOOST_MOVE_RET(RET_TYPE, REF)\

     (REF)
  //

with

  #define BOOST_MOVE_RET(RET_TYPE, REF)\
     REF
  //

could be a better fix. Could you try it, please?

Flast commented 9 years ago
  #define BOOST_MOVE_RET(RET_TYPE, REF)\
     REF
  //

Ah, yes. It should work. I'll resend a patch.

igaztanaga commented 9 years ago

I've committed:

SHA-1: 1f6892c935633a322a8f0464ef34810c9a613d6e

Let's see if this fixes the problem. Thanks for the report.

Flast commented 9 years ago

Good! It works fine me!