[Bug c++/53584] New: [4.7 Regression] [C++0x] deleted function unique_ptr::operator=(const unique_ptr )

2012-06-05 Thread liling at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53584

 Bug #: 53584
   Summary: [4.7 Regression] [C++0x] deleted function
unique_ptr::operator=(const unique_ptr )
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: lil...@gmail.com


The following code can compile with G++ 4.6 but not 4.7.  G++ 4.7 complains
that the deleted function std::unique_ptr_Tp, _Dp::operator=(const
std::unique_ptr_Tp, _Dp) is required.  However, please note that the code is
doing a move assignment.  Strangely, removing the customized destructor
~UniqVec makes G++ 4.7 happy.

$ cat test.cpp
#include memory
#include vector

struct UniqVec : public std::vectorstd::unique_ptrint {
~UniqVec() {} // Comment this line out and GCC 4.7 will be happy.
};

void f() {
UniqVec u, v;
u = std::move(v);
}

$ g++ -c -std=c++0x test.cpp 
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/memory:64:0,
 from test.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:
In instantiation of ‘static _OI std::__copy_movefalse, false,
std::random_access_iterator_tag::__copy_m(_II, _II, _OI) [with _II = const
std::unique_ptrint*; _OI = std::unique_ptrint*]’:
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:384:70:
  required from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove =
false; _II = const std::unique_ptrint*; _OI = std::unique_ptrint*]’
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:422:39:
  required from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove =
false; _II = __gnu_cxx::__normal_iteratorconst std::unique_ptrint*,
std::vectorstd::unique_ptrint  ; _OI =
__gnu_cxx::__normal_iteratorstd::unique_ptrint*,
std::vectorstd::unique_ptrint  ]’
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:454:18:
  required from ‘_OI std::copy(_II, _II, _OI) [with _II =
__gnu_cxx::__normal_iteratorconst std::unique_ptrint*,
std::vectorstd::unique_ptrint  ; _OI =
__gnu_cxx::__normal_iteratorstd::unique_ptrint*,
std::vectorstd::unique_ptrint  ]’
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/vector.tcc:197:8:
  required from ‘std::vector_Tp, _Alloc std::vector_Tp,
_Alloc::operator=(const std::vector_Tp, _Alloc) [with _Tp =
std::unique_ptrint; _Alloc = std::allocatorstd::unique_ptrint ]’
test.cpp:4:8:   required from here
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:329:8:
error: use of deleted function ‘std::unique_ptr_Tp, _Dp std::unique_ptr_Tp,
_Dp::operator=(const std::unique_ptr_Tp, _Dp) [with _Tp = int; _Dp =
std::default_deleteint]’
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/memory:86:0,
 from test.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/unique_ptr.h:257:19:
error: declared here
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/memory:64:0,
 from test.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:
In instantiation of ‘static _OI std::__copy_movefalse, false,
std::random_access_iterator_tag::__copy_m(_II, _II, _OI) [with _II =
std::unique_ptrint*; _OI = std::unique_ptrint*]’:
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:384:70:
  required from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove =
false; _II = std::unique_ptrint*; _OI = std::unique_ptrint*]’
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:422:39:
  required from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove =
false; _II = std::unique_ptrint*; _OI = std::unique_ptrint*]’
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:454:18:
  required from ‘_OI std::copy(_II, _II, _OI) [with _II =
std::unique_ptrint*; _OI = std::unique_ptrint*]’
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/vector.tcc:202:8:
  required from ‘std::vector_Tp, _Alloc std::vector_Tp,
_Alloc::operator=(const std::vector_Tp, _Alloc) [with _Tp =
std::unique_ptrint; _Alloc = std::allocatorstd::unique_ptrint ]’
test.cpp:4:8:   required from here
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:329:8:
error: use of deleted function ‘std::unique_ptr_Tp, _Dp std::unique_ptr_Tp,
_Dp::operator=(const std::unique_ptr_Tp, _Dp) [with _Tp = int; _Dp =
std::default_deleteint]’
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/memory:86:0,
 

[Bug c++/53584] [4.7 Regression] [C++0x] deleted function unique_ptr::operator=(const unique_ptr )

2012-06-05 Thread liling at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53584

--- Comment #2 from Ling Li liling at gmail dot com 2012-06-05 20:59:24 UTC 
---
You are right.  My bad.  I thought having a user-declared destructor would be
different than having a user-declared constructor, and the fact that GCC 4.6
accepted the code doubled my belief.  I should have checked the standard. 
Thanks for your time.


[Bug c++/53503] [4.7 Regression] [C++0x] unexpected AST of kind ltgt_expr

2012-05-28 Thread liling at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53503

--- Comment #5 from Ling Li liling at gmail dot com 2012-05-28 12:37:44 UTC 
---
Thanks much for the super quick fix.


[Bug c++/53503] New: [4.7 Regression] [C++0x] unexpected AST of kind ltgt_expr

2012-05-27 Thread liling at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53503

 Bug #: 53503
   Summary: [4.7 Regression] [C++0x] unexpected AST of kind
ltgt_expr
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: lil...@gmail.com


Created attachment 27510
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27510
Preporcessed source

G++ 4.7 can't compile a one-line file with both -std=c++0x and
-fno-trapping-math:

$ cat a.cpp
#include cmath
$ g++ -fno-trapping-math -std=c++0x -c a.cpp
In file included from a.cpp:1:0:
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cmath: In
function ‘constexpr bool std::islessgreater(float, float)’:
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cmath:764:47:
sorry, unimplemented: unexpected AST of kind ltgt_expr
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/cmath:764:
confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccGqxqjD.out file, please attach this to
your bugreport.

I was using GCC 4.7.0 20120507 on Fedora 17.