public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59312] New: Incorrect warning "defaulted move assignment for ... calls a non-trivial move assignment operator for virtual base ..."
@ 2013-11-27 13:49 alexander.o.khovansky at yandex dot com
  2013-11-27 14:35 ` [Bug c++/59312] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: alexander.o.khovansky at yandex dot com @ 2013-11-27 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59312
           Summary: Incorrect warning "defaulted move assignment for ...
                    calls a non-trivial move assignment operator for
                    virtual base ..."
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexander.o.khovansky at yandex dot com

Minimal test case:

#include <string>
struct A { std::string s; };
struct B : virtual A {};

int main(int argc, char* argv[]) {
    B b1, b2;
    b2 = b1;
}

This produces warning at line 3:
defaulted move assignment for ‘B’ calls a non-trivial move assignment operator
for virtual base ‘A’ [-Wvirtual-move-assign]

Tested on versions available on gcc.godbolt.org - 4.8.1, 4.9.0 20130909 - with
option -std=c++11.


The standard says the following.

12.8.20:
If the definition of a class X does not explicitly declare a move assignment
operator, one will be implicitly declared as defaulted if and only if
...
— the move assignment operator would not be implicitly defined as deleted.

12.8.23:
A defaulted ... move assignment operator for class X is defined as deleted if X
has:
...
— any direct or indirect virtual base class.

The B class does have virtual base, so it cannot have implicit move assignment
operator.
>From gcc-bugs-return-436019-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Nov 27 13:51:24 2013
Return-Path: <gcc-bugs-return-436019-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3458 invoked by alias); 27 Nov 2013 13:51:24 -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 3438 invoked by uid 48); 27 Nov 2013 13:51:20 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/59311] FAIL: g++.dg/cpp1y/vla-initlist1.C (test for excess errors)
Date: Wed, 27 Nov 2013 13:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc component
Message-ID: <bug-59311-4-9LMmy9CqwE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59311-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59311-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-11/txt/msg02796.txt.bz2
Content-length: 1696

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at redhat dot com
          Component|c++                         |rtl-optimization

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
It looks like a LRA bug on x86.  x.ii.212r.ira has

insn/f 202 3 2 2 (set (reg:SI 177)
        (reg:SI 2 cx)) 86 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 2 cx)
        (expr_list:REG_CFA_SET_VDRAP (reg:SI 177)
            (nil))))

x.ii.213r.reload has

(insn/f 202 3 2 2 (set (mem/c:SI (plus:SI (reg/f:SI 6 bp)
                (const_int -48 [0xffffffffffffffd0])) [0 %sfp+-48 S4 A32])
        (reg:SI 2 cx)) 86 {*movsi_internal}
     (expr_list:REG_CFA_SET_VDRAP (reg:SI 177)
        (nil)))

Should the REG_CFA_SET_VDRAP note be dropped or should
dwarf2out_frame_debug handle

(gdb) call debug_rtx (insn)
(insn/f 202 254 2 2 (set (mem/c:SI (plus:SI (reg/f:SI 6 bp)
                (const_int -48 [0xffffffffffffffd0])) [0 %sfp+-48 S4 A32])
        (reg:SI 2 cx)) 86 {*movsi_internal}
     (expr_list:REG_CFA_SET_VDRAP (reg:SI 177)
        (nil)))
(gdb)

in
     case REG_CFA_SET_VDRAP:
        n = XEXP (note, 0);
        if (REG_P (n))
          {
            dw_fde_ref fde = cfun->fde;
            if (fde)
              {
                gcc_assert (fde->vdrap_reg == INVALID_REGNUM);
                if (REG_P (n))
                  fde->vdrap_reg = dwf_regno (n);
              }
          }
        handled_one = true;
        break;


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

* [Bug c++/59312] Incorrect warning "defaulted move assignment for ... calls a non-trivial move assignment operator for virtual base ..."
  2013-11-27 13:49 [Bug c++/59312] New: Incorrect warning "defaulted move assignment for ... calls a non-trivial move assignment operator for virtual base ..." alexander.o.khovansky at yandex dot com
@ 2013-11-27 14:35 ` redi at gcc dot gnu.org
  2013-11-28 11:28 ` redi at gcc dot gnu.org
  2015-03-25 19:09 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-11-27 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Which document are you looking at? That's not what 12.8/23 in the standard
says.


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

* [Bug c++/59312] Incorrect warning "defaulted move assignment for ... calls a non-trivial move assignment operator for virtual base ..."
  2013-11-27 13:49 [Bug c++/59312] New: Incorrect warning "defaulted move assignment for ... calls a non-trivial move assignment operator for virtual base ..." alexander.o.khovansky at yandex dot com
  2013-11-27 14:35 ` [Bug c++/59312] " redi at gcc dot gnu.org
@ 2013-11-28 11:28 ` redi at gcc dot gnu.org
  2015-03-25 19:09 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-11-28 11:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Alexander Khovansky from comment #0)
> — any direct or indirect virtual base class.

I'm looking at N3290, but was looking for a bullet starting with that text. Now
I see it's at the very end of the last bullet, sorry.

In any case, that isn't in the current draft, it was removed by
http://open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1402 and G++
implements that resolution.
>From gcc-bugs-return-436109-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 28 11:29:56 2013
Return-Path: <gcc-bugs-return-436109-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6409 invoked by alias); 28 Nov 2013 11:29:56 -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 5009 invoked by uid 48); 28 Nov 2013 11:29:20 -0000
From: "amylaar at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/59327] warning in expand_used_vars
Date: Thu, 28 Nov 2013 11:29:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: amylaar at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59327-4-7YgH0NS9YY@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59327-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59327-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-11/txt/msg02886.txt.bz2
Content-length: 252

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

--- Comment #1 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> ---
The warning also happens when using g++ (GCC) 4.9.0 20131128 (experimental),
and when building gcc for target epiphany-elf.


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

* [Bug c++/59312] Incorrect warning "defaulted move assignment for ... calls a non-trivial move assignment operator for virtual base ..."
  2013-11-27 13:49 [Bug c++/59312] New: Incorrect warning "defaulted move assignment for ... calls a non-trivial move assignment operator for virtual base ..." alexander.o.khovansky at yandex dot com
  2013-11-27 14:35 ` [Bug c++/59312] " redi at gcc dot gnu.org
  2013-11-28 11:28 ` redi at gcc dot gnu.org
@ 2015-03-25 19:09 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-25 19:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Closing then.


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

end of thread, other threads:[~2015-03-25 18:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-27 13:49 [Bug c++/59312] New: Incorrect warning "defaulted move assignment for ... calls a non-trivial move assignment operator for virtual base ..." alexander.o.khovansky at yandex dot com
2013-11-27 14:35 ` [Bug c++/59312] " redi at gcc dot gnu.org
2013-11-28 11:28 ` redi at gcc dot gnu.org
2015-03-25 19:09 ` paolo.carlini at oracle dot com

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).