public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56889] New: =delete(ing) default copy and move operations for a polymorphic type gives compilation error messages
@ 2013-04-09  6:02 amalisperid at yahoo dot com
  2013-04-09  9:10 ` [Bug c++/56889] " daniel.kruegler at googlemail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: amalisperid at yahoo dot com @ 2013-04-09  6:02 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56889
           Summary: =delete(ing) default copy and move operations for a
                    polymorphic type gives compilation error messages
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: amalisperid@yahoo.com


Created attachment 29834
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29834
smalltestfile

when I add 
 Stack(const Stack&)=delete;
   Stack& operator=(const Stack&)=delete;
   //no move operations
   Stack(Stack&&)=delete;
   Stack& operator=(Stack&&)=delete;
to the stack polymorphic type in the attached file, the compiler gives error
messages. But if I don't add these methods, as Bjarne Stroutstrup's programming
language fourth edition-third chapter draft copy- says,
'In case you forgot to delete a copy or move operation, no harm is done. A move
operation is not implicitly generated for a class where the user has explicitly
declared a destructor. Furthermore, the generation of copy operations are
deprecated in this case
(§42.2.3). This can be a good reason to explicitly define a destructor even
where the compiler would have implicitly provided one (§17.2.3).
The C++ Programming Language, 4th edition ©2012 by Pearson Education, Inc.
Reproduced in draft form with the permission of the publisher.', my program
gives nomore compiler error messages, and it works as I expect it to.
However, I think the compiler should allow me to specify the copy and move
methods as =delete in the Stack polymorphic type.


-------------- Build: Debug in TestforError ---------------

x86_64-w64-mingw32-g++.exe -Wall -fexceptions  -g  -std=c++0x -Wextra -Wall -v
-save-temps -fno-strict-aliasing -fwrapv    -c "C:\Users\Pugazhendhi
Albert\Desktop\Amali\TestforError\main.cpp" -o obj\Debug\main.o
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-g++.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.8.0/configure --host=x86_64-w64-mingw32
--build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64
--with-sysroot=/temp/x64-480-win32-seh-r1/mingw64 --enable-shared
--enable-static --disable-multilib --enable-languages=c,c++,fortran,lto
--enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp
--enable-lto --enable-graphite --enable-checking=release
--enable-fully-dynamic-string --enable-version-specific-runtime-libs
--disable-isl-version-check --disable-cloog-version-check
--disable-libstdcxx-pch --disable-libstdcxx-debug --disable-bootstrap
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona
--with-tune=core2 --with-host-libstdcxx='-static -lstdc++' --with-libiconv
--with-system-zlib --with-gmp=/temp/mingw-prereq/x86_64-w64-mingw32-static
--with-mpfr=/temp/mingw-prereq/x86_64-w64-mingw32-static
--with-mpc=/temp/mingw-prereq/x86_64-w64-mingw32-static
--with-isl=/temp/mingw-prereq/x86_64-w64-mingw32-static
--with-cloog=/temp/mingw-prereq/x86_64-w64-mingw32-static
--enable-cloog-backend=isl --with-pkgversion='rev1, Built by MinGW-builds
project' --with-bugurl=http://sourceforge.net/projects/mingwbuilds/ CFLAGS='-O2
-pipe -I/temp/x64-480-win32-seh-r1/libs/include
-I/temp/mingw-prereq/x64-zlib/include
-I/temp/mingw-prereq/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe
-I/temp/x64-480-win32-seh-r1/libs/include -I/temp/mingw-prereq/x64-zlib/include
-I/temp/mingw-prereq/x86_64-w64-mingw32-static/include' CPPFLAGS=
LDFLAGS='-pipe -L/temp/x64-480-win32-seh-r1/libs/lib
-L/temp/mingw-prereq/x64-zlib/lib
-L/temp/mingw-prereq/x86_64-w64-mingw32-static/lib
-L/temp/x64-480-win32-seh-r1/mingw64/opt/lib'
Thread model: win32
gcc version 4.8.0 (rev1, Built by MinGW-builds project) 
COLLECT_GCC_OPTIONS='-fexceptions' '-g' '-std=c++11' '-Wextra' '-Wall' '-v'
'-save-temps' '-fno-strict-aliasing' '-fwrapv' '-c' '-o' 'obj\Debug\main.o'
'-shared-libgcc' '-mtune=core2' '-march=nocona'

c:/amali/x64-4.8.0-release-win32-seh-rev1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.0/cc1plus.exe
-E -quiet -v -iprefix
c:\amali\x64-4.8.0-release-win32-seh-rev1\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.8.0/
-U_REENTRANT C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp
-mtune=core2 -march=nocona -std=c++11 -Wextra -Wall -fexceptions
-fno-strict-aliasing -fwrapv -g -fworking-directory -fpch-preprocess -o main.ii
ignoring duplicate directory
"c:/amali/x64-4.8.0-release-win32-seh-rev1/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.8.0/include/c++"
ignoring duplicate directory
"c:/amali/x64-4.8.0-release-win32-seh-rev1/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.8.0/include/c++/x86_64-w64-mingw32"
ignoring duplicate directory
"c:/amali/x64-4.8.0-release-win32-seh-rev1/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.8.0/include/c++/backward"
ignoring duplicate directory
"c:/amali/x64-4.8.0-release-win32-seh-rev1/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.8.0/include"
ignoring nonexistent directory
"C:/gccbuild/msys/temp/x64-480-win32-seh-r1/mingw64C:/gccbuild/msys/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../include"
ignoring duplicate directory
"c:/amali/x64-4.8.0-release-win32-seh-rev1/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.8.0/include-fixed"
ignoring duplicate directory
"c:/amali/x64-4.8.0-release-win32-seh-rev1/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory
"C:/gccbuild/msys/temp/x64-480-win32-seh-r1/mingw64/mingw/include"
#include "..." search starts here:
#include <...> search starts here:

c:\amali\x64-4.8.0-release-win32-seh-rev1\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.8.0/include/c++

c:\amali\x64-4.8.0-release-win32-seh-rev1\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.8.0/include/c++/x86_64-w64-mingw32

c:\amali\x64-4.8.0-release-win32-seh-rev1\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.8.0/include/c++/backward

c:\amali\x64-4.8.0-release-win32-seh-rev1\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.8.0/include

c:\amali\x64-4.8.0-release-win32-seh-rev1\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.8.0/include-fixed

c:\amali\x64-4.8.0-release-win32-seh-rev1\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/include
End of search list.
COLLECT_GCC_OPTIONS='-fexceptions' '-g' '-std=c++11' '-Wextra' '-Wall' '-v'
'-save-temps' '-fno-strict-aliasing' '-fwrapv' '-c' '-o' 'obj\Debug\main.o'
'-shared-libgcc' '-mtune=core2' '-march=nocona'

c:/amali/x64-4.8.0-release-win32-seh-rev1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.0/cc1plus.exe
-fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=core2 -march=nocona
-auxbase-strip obj\Debug\main.o -g -Wextra -Wall -std=c++11 -version
-fexceptions -fno-strict-aliasing -fwrapv -o main.s
GNU C++ (rev1, Built by MinGW-builds project) version 4.8.0
(x86_64-w64-mingw32)
    compiled by GNU C version 4.7.2, GMP version 5.1.1, MPFR version 3.1.2, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (rev1, Built by MinGW-builds project) version 4.8.0
(x86_64-w64-mingw32)
    compiled by GNU C version 4.7.2, GMP version 5.1.1, MPFR version 3.1.2, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 198a59f18ac22b34b3ce85756ec21810
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp: In function
'void StackAbst::constanduse()':
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:92:46: error:
use of deleted function
'StackAbst::vector_stack<int>::vector_stack(std::initializer_list<int>)'
    vector_stack<int> vst{1,2,3,4,5,6,7,8,9,10};
                                              ^
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:39:19: note:
'StackAbst::vector_stack<int>::vector_stack(std::initializer_list<int>)' is
implicitly deleted because the default definition would be ill-formed:
       using Base::Base;
                   ^
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:39:19: error:
no matching function for call to 'StackAbst::Stack<int>::Stack()'
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:39:19: note:
candidates are:
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:19:4: note:
StackAbst::Stack<T>::Stack(StackAbst::Stack<T>&&) [with T = int] <deleted>
    Stack(Stack&&)=delete;
    ^
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:19:4: note:  
candidate expects 1 argument, 0 provided
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:16:4: note:
StackAbst::Stack<T>::Stack(const StackAbst::Stack<T>&) [with T = int] <deleted>
    Stack(const Stack&)=delete;
    ^
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:16:4: note:  
candidate expects 1 argument, 0 provided
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp: In
instantiation of 'StackAbst::vector_stack<T>*
StackAbst::vector_stack<T>::clone() const [with T = int]':
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:102:1:  
required from here
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:43:39: error:
use of deleted function 'StackAbst::vector_stack<int>::vector_stack(const
StackAbst::vector_stack<int>&)'
          return new vector_stack(*this); // using copy constructor
                                       ^
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:32:7: note:
'StackAbst::vector_stack<int>::vector_stack(const
StackAbst::vector_stack<int>&)' is implicitly deleted because the default
definition would be ill-formed:
 class vector_stack : public Stack<T>, private std::vector<T>{
       ^
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:32:7: error:
use of deleted function 'StackAbst::Stack<T>::Stack(const StackAbst::Stack<T>&)
[with T = int]'
C:\Users\Pugazhendhi Albert\Desktop\Amali\TestforError\main.cpp:16:4: error:
declared here
    Stack(const Stack&)=delete;
    ^
Process terminated with status 1 (0 minutes, 0 seconds)
13 errors, 0 warnings
>From gcc-bugs-return-419559-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 09 06:15:54 2013
Return-Path: <gcc-bugs-return-419559-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21709 invoked by alias); 9 Apr 2013 06:15:54 -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 21665 invoked by uid 48); 9 Apr 2013 06:15:50 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/56885] ICE: in assign_by_spills, at lra-assigns.c:1268 with -O -fschedule-insns -fselective-scheduling
Date: Tue, 09 Apr 2013 06:15: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-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.1
X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Target Milestone Ever Confirmed
Message-ID: <bug-56885-4-bAjTGfR1oc@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56885-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56885-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg00704.txt.bz2
Content-length: 1584


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-09
                 CC|                            |mpolacek at gcc dot
                   |                            |gnu.org, vmakarov at gcc
                   |                            |dot gnu.org
   Target Milestone|---                         |4.8.1
     Ever Confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-04-09 06:15:49 UTC ---
Confirmed with trunk/4.8, but with 4.6/4.7 I see:

x.c:20:1: error: unable to find a register to spill in class ‘DIREG’
x.c:20:1: error: this is the insn:
(insn 33 36 35 5 (parallel [
            (set (reg:DI 2 cx [80])
                (const_int 0 [0]))
            (set (reg/f:DI 0 ax [78])
                (plus:DI (reg/f:DI 1 dx [77])
                    (reg:DI 2 cx [80])))
            (set (mem:BLK (reg/f:DI 1 dx [77]) [0 S15 A8])
                (const_int 0 [0]))
            (use (reg:QI 6 bp [81]))
            (use (reg:DI 2 cx [80]))
        ]) x.c:16 884 {*rep_stosqi}
     (expr_list:REG_DEAD (reg/f:DI 1 dx [77])
        (expr_list:REG_UNUSED (reg:DI 2 cx [80])
            (expr_list:REG_UNUSED (reg/f:DI 0 ax [78])
                (nil)))))
x.c:20: confused by earlier errors, bailing out
>From gcc-bugs-return-419560-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 09 06:29:16 2013
Return-Path: <gcc-bugs-return-419560-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27571 invoked by alias); 9 Apr 2013 06:29:16 -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 27539 invoked by uid 48); 9 Apr 2013 06:29:13 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/56885] ICE: in assign_by_spills, at lra-assigns.c:1268 with -O -fschedule-insns -fselective-scheduling
Date: Tue, 09 Apr 2013 06:29: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-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.1
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56885-4-DECPtYwB2g@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56885-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56885-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg00705.txt.bz2
Content-length: 232


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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-04-09 06:29:13 UTC ---
Anyway, started with
http://gcc.gnu.org/viewcvs/gcc?view=revision&revision\x192719


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

end of thread, other threads:[~2013-04-12  3:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-09  6:02 [Bug c++/56889] New: =delete(ing) default copy and move operations for a polymorphic type gives compilation error messages amalisperid at yahoo dot com
2013-04-09  9:10 ` [Bug c++/56889] " daniel.kruegler at googlemail dot com
2013-04-09  9:36 ` daniel.kruegler at googlemail dot com
2013-04-09 12:26 ` redi at gcc dot gnu.org
2013-04-09 19:02 ` amalisperid at yahoo dot com
2013-04-09 19:13 ` daniel.kruegler at googlemail dot com
2013-04-11 12:42 ` redi at gcc dot gnu.org
2013-04-12  3:39 ` amalisperid at yahoo 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).