public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57901] New: [C++11][constexpr] Cannot call-by-value such that class has non-trivial (constexpr) move constructor
@ 2013-07-15 18:19 bolero.murakami at gmail dot com
  2013-07-22 10:02 ` [Bug c++/57901] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bolero.murakami at gmail dot com @ 2013-07-15 18:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57901

            Bug ID: 57901
           Summary: [C++11][constexpr] Cannot call-by-value such that
                    class has non-trivial (constexpr) move constructor
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bolero.murakami at gmail dot com

Code:
//--------
struct Z {
    Z()         = default;
    Z(Z const&) = default;
    constexpr Z(Z&&) {} /* non-trivial (constexpr) move ctor */
};

template<typename T>
constexpr int fn0(T v) { return 0; }
template<typename T>
constexpr int fn (T v) { return fn0(v); }

constexpr auto t0 = fn0(Z()); // OK!
constexpr auto t  = fn (Z()); // error! (GCC 4.8.1, -std=c++11)
//--------

Error message:
in constexpr expansion of ‘fn<Z>(Z())’
error: ‘v’ is not a constant expression
   constexpr auto t = fn(Z());
                            ^


Class Z is literal type.
However, compilation error when it is call-by-value(more than once).

I tested this code in gcc-4.7.3, is passed.
The problem is reproduced in gcc-4.8.0, gcc-4.8.1
>From gcc-bugs-return-426242-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 15 19:25:27 2013
Return-Path: <gcc-bugs-return-426242-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31733 invoked by alias); 15 Jul 2013 19:25:27 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 26683 invoked by uid 48); 15 Jul 2013 19:23:23 -0000
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/52669] No warning in unused private variable in modules
Date: Mon, 15 Jul 2013 19:25:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: minor
X-Bugzilla-Who: tkoenig at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: tkoenig at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-52669-4-Ufmwl01zww@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-52669-4@http.gcc.gnu.org/bugzilla/>
References: <bug-52669-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-07/txt/msg00749.txt.bz2
Content-length: 482

http://gcc.gnu.org/bugzilla/show_bug.cgi?idR669

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Tobias, thanks for posting the commit message.

Fixed, closing.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57901] [4.8/4.9 Regression] Cannot call-by-value such that class has non-trivial (constexpr) move constructor
  2013-07-15 18:19 [Bug c++/57901] New: [C++11][constexpr] Cannot call-by-value such that class has non-trivial (constexpr) move constructor bolero.murakami at gmail dot com
@ 2013-07-22 10:02 ` paolo.carlini at oracle dot com
  2013-07-29 20:18 ` jason at gcc dot gnu.org
  2013-07-30 16:59 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-22 10:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57901

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-07-22
      Known to work|                            |4.7.3
            Summary|[C++11][constexpr] Cannot   |[4.8/4.9 Regression] Cannot
                   |call-by-value such that     |call-by-value such that
                   |class has non-trivial       |class has non-trivial
                   |(constexpr) move            |(constexpr) move
                   |constructor                 |constructor
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.0, 4.8.1, 4.9.0

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
We may have a Dup of this.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57901] [4.8/4.9 Regression] Cannot call-by-value such that class has non-trivial (constexpr) move constructor
  2013-07-15 18:19 [Bug c++/57901] New: [C++11][constexpr] Cannot call-by-value such that class has non-trivial (constexpr) move constructor bolero.murakami at gmail dot com
  2013-07-22 10:02 ` [Bug c++/57901] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
@ 2013-07-29 20:18 ` jason at gcc dot gnu.org
  2013-07-30 16:59 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2013-07-29 20:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57901

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Target Milestone|---                         |4.8.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57901] [4.8/4.9 Regression] Cannot call-by-value such that class has non-trivial (constexpr) move constructor
  2013-07-15 18:19 [Bug c++/57901] New: [C++11][constexpr] Cannot call-by-value such that class has non-trivial (constexpr) move constructor bolero.murakami at gmail dot com
  2013-07-22 10:02 ` [Bug c++/57901] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
  2013-07-29 20:18 ` jason at gcc dot gnu.org
@ 2013-07-30 16:59 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2013-07-30 16:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57901

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.2/4.9.0.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-30 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15 18:19 [Bug c++/57901] New: [C++11][constexpr] Cannot call-by-value such that class has non-trivial (constexpr) move constructor bolero.murakami at gmail dot com
2013-07-22 10:02 ` [Bug c++/57901] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
2013-07-29 20:18 ` jason at gcc dot gnu.org
2013-07-30 16:59 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).