🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #952

reference return works not for member references

#952
From: dak
Date: Sun, 13 Sep 1992 11:51
23 lines
1358 bytes
The following bounces. (BTW, can anyone imagine why
.* and ->* should have lower priority than . and -> ?
It is in ARM but foolish. a pity)

struct V {
	int x;
} X;

typedef int V::* Vptr;

int &test(Vptr y)
{
	return X.*y;		// This produces warning and bad code
	return *&(X.*y);	// Workaround
}
Reading specs from /usr/local/lib/gcc-lib/i386-isc-isc/2.2.2/specs
gcc version 2.2.2
 /usr/local/lib/gcc-lib/i386-isc-isc/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dunix -Di386 -D__unix__ -D__i386__ -D__unix -D__i386 bug.cc /usr/tmp/cca00591.i
GNU CPP version 2.2.2 (80386, ATT syntax)
 /usr/local/lib/gcc-lib/i386-isc-isc/2.2.2/cc1plus /usr/tmp/cca00591.i -quiet -dumpbase bug.cc -version -o bug.s
GNU C++ version 2.2.2 (80386, ATT syntax) compiled by GNU C version 2.2.2.
bug.cc: In function `int & test (int (struct V::*))':
bug.cc:9: warning: reference to non-lvalue returned
Technical Details
Message-ID: <9209130751.AA19566@rama>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pool.INformatik.rwth-aachen.DE!dak

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pool.INformatik.rwth-aachen.DE!dak
From: dak@pool.INformatik.rwth-aachen.DE
Subject: reference return works not for member references
Message-ID: <9209130751.AA19566@rama>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 13 Sep 1992 11:51:19 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 24