[Bug c++/60168] New: Incorrect check in ~unique_ptr() when Deleter::pointer type is not a pointer type
ashish.sadanandan at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Feb 13 05:40:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60168
Bug ID: 60168
Summary: Incorrect check in ~unique_ptr() when Deleter::pointer
type is not a pointer type
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ashish.sadanandan at gmail dot com
The following compiles on both VS2013 and ICC 13.0.1
#include <memory>
struct del
{
using pointer = int;
void operator()(int) {}
};
int main()
{
std::unique_ptr<int, del> p;
}
It fails on gcc4.8.1 with this error
/usr/include/c++/4.8/bits/unique_ptr.h: In instantiation of
'std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = int; _Dp = del]':
main.cpp:13:35: required from here
/usr/include/c++/4.8/bits/unique_ptr.h:183:12: error: invalid operands of types
'int' and 'std::nullptr_t' to binary 'operator!='
if (__ptr != nullptr)
I believe that last if statement should be
if (__ptr != pointer())
More information about the Gcc-bugs
mailing list