https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63437

            Bug ID: 63437
           Summary: [4.9/5 regression][C++14] Parenthesized "movable but
                    not copyable" object doesn't compile in return
                    statement
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: flast at flast dot jp

After GCC 4.9, parenthesized "movable but not copyable" object doesn't compile
in return statement under C++14 mode (C++11 mode does compile).
I'm not sure that the behavior was changed in C++14 spec; Clang seems compile
under both of C++11/14 mode.

example:
----
struct X // movable but not copyable
{
    X() = default;
    X(X &&) = default;

    X(const X &) = delete;
};

X non_parenthesized()
{
    X x;
    return x; // works
}

X parenthesized()
{
    X x;
    return (x); // error: use of deleted function 'X::X(const X&)'
}
----

Online compiler results:
- GCC 4.8.2
 - C++11 http://melpon.org/wandbox/permlink/lRR60fvDgKfqd0UZ
 - C++14 http://melpon.org/wandbox/permlink/BAdrBmEG3euQLnqv

- GCC 4.9.1
 - C++11 http://melpon.org/wandbox/permlink/XllfUNu0VV0mnYsu
 - C++14 http://melpon.org/wandbox/permlink/qm67F6vODyADgKvQ (fail)

- GCC 5.0 20141001
 - C++11 http://melpon.org/wandbox/permlink/21bPbcuXB7S87DUG
 - C++14 http://melpon.org/wandbox/permlink/da8AeqX7HrS17T2n (fail)

- Clang 3.5.0
 - C++11 http://melpon.org/wandbox/permlink/VqgnlKRTOBHd5IDt
 - C++14 http://melpon.org/wandbox/permlink/tAkgLiaD50nOMtEz

Reply via email to