Opened 14 years ago

Closed 14 years ago

#2121 closed Bugs (fixed)

unspecified_bool_type - based operator bool emulations result in meaningless comparison operators

Reported by: anonymous Owned by: Peter Dimov
Milestone: Boost 1.36.0 Component: smart_ptr
Version: Boost 1.35.0 Severity: Cosmetic
Keywords: unspecified_bool_type comparison operators Cc: gregory.petrosyan@…

Description

#include <iostream>
#include <boost/scoped_ptr.hpp>

int main()
{
    typedef boost::scoped_ptr<int> ptr_t;

    ptr_t x(new int);
    ptr_t y(new int);

    std::cout << (x != y) << std::endl;
    std::cout << (x == y) << std::endl;

    return 0;
}

Change History (2)

comment:1 by Marshall Clow, 14 years ago

Component: Nonesmart_ptr
Owner: set to Peter Dimov

Trying this on the 1.36 release branch using gcc 4.2 gives me compile errors:

junk.cpp: In function ‘int main()’: /Users/marshall/Sources/boost/release/boost/scoped_ptr.hpp:51: error: ‘void boost::scoped_ptr<T>::operator!=(const boost::scoped_ptr<T>&) const [with T = int]’ is private junk.cpp:11: error: within this context

comment:2 by Peter Dimov, 14 years ago

Resolution: fixed
Status: newclosed

This is a duplicate of #1444, which has been fixed with [43317].

Note: See TracTickets for help on using tickets.