From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21282 invoked by alias); 10 Nov 2002 20:26:27 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 21263 invoked by uid 61); 10 Nov 2002 20:26:27 -0000 Date: Sun, 10 Nov 2002 12:26:00 -0000 Message-ID: <20021110202627.21262.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, johan@tiq.com, nobody@gcc.gnu.org From: bangerth@dealii.org Reply-To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, johan@tiq.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: c++/880: Return type of type operator is not equivalent to return type of member function. X-SW-Source: 2002-11/txt/msg00484.txt.bz2 List-Id: Synopsis: Return type of type operator is not equivalent to return type of member function. State-Changed-From-To: analyzed->closed State-Changed-By: bangerth State-Changed-When: Sun Nov 10 12:26:25 2002 State-Changed-Why: The array assignment extension seems to have gone, and the code now produces consistent messages. With this code: ----------------------------------- typedef float vec2_t[2]; class vec2 { private: vec2_t v; public: operator vec2_t & () { return v; } vec2_t & asvec2_t () { return v;} }; vec2_t & func (vec2_t & v) { return v; } int main (int argc, char **argv) { vec2_t U, V; vec2 v; U = V; // array-to-array copy float f = v[0]; // implicit call to vec2::operator vec2_t & () U = v.asvec2_t(); // explicit conversion U = func (v); // implicit call to vec2::operator vec2_t & () U = v; // Error: "incompatible types in assignment of // `vec2' to `float[2]'". Now this is inconsistent // behaviour and seems to me as a bug. } ------------------------------------ I now get: ------------------------------- tmp/g> /home/bangerth/bin/gcc-3.3x-pre/bin/c++ -c cpptest.cpp cpptest.cpp: In function `int main(int, char**)': cpptest.cpp:20: error: ISO C++ forbids assignment of arrays cpptest.cpp:22: error: ISO C++ forbids assignment of arrays cpptest.cpp:23: error: ISO C++ forbids assignment of arrays cpptest.cpp:24: error: incompatible types in assignment of `vec2' to `float[2]' http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=880