Xref: utzoo comp.lang.c++:13809 gnu.g++.bug:2816 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!bu.edu!ai-lab!ai.mit.edu!gnulists From: schmidt@crimee.ics.uci.edu (Douglas C. Schmidt) Newsgroups: comp.lang.c++,gnu.g++.bug Subject: references as class member variables Message-ID: <9105300036.aa15925@ics.uci.edu> Date: 30 May 91 07:36:15 GMT Followup-To: comp.lang.c++ Lines: 33 Approved: info-gnu@prep.ai.mit.edu Nntp-Posting-Host: crimee.ics.uci.edu To: moderator:; Hi, I'm curious... Does anyone know what the "proper" output for the following program should be (or is it perhaps officially undefined?) g++ prints 10, 11, whereas cfront 2.0 prints 11, 11. -------------------------------------- struct Foo { int &r; Foo (int s): r (s) { } }; extern "C" void printf (const char *, ...); main () { Foo f (10); Foo g (11); printf ("%d, %d\n", f.r, g.r); } ---------------------------------------- Thanks, Doug -- His life was gentle, and the elements so | Douglas C. Schmidt Mixed in him that nature might stand up | (schmidt@ics.uci.edu) And say to all the world: "This was a man." | (714) 856-4101 -- In loving memory of Terry Williams (1971-1991)|