This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/22632] New: GCC won't produce assignment operator warnings


When building with all warnings enabled, GCC can fail to warn when an assignment operator can't be 
generated.

Steps:

Use the compiler arguments:
-g -Wall -ansi -pedantic -c

to compile the following C++ code:
#include <functional>

class SetValue : public std::unary_function<int, void>
{
public:
    SetValue(int& value) : m_value(value) {}
    void operator() (int value) { m_value = value; }
private:
    int& m_value;
};

Results:
The code will compile with no warnings

Expected:
The compiler is unable to generate an assignment operator, and errors will occur if code like the 
following is used:

int value = 42;
SetValue functor(42);

int anotherValue = 13;
SetValue anotherFunctor(anotherValue);
anotherFunctor = functor;

The compiler should warn against such problems.

-- 
           Summary: GCC won't produce assignment operator warnings
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tron dot thomas at verizon dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]