Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!ARIZONA.EDU!francis%sunquest.UUCP
From: francis%sunquest.UUCP@ARIZONA.EDU ("Francis Sullivan")
Newsgroups: gnu.g++.bug
Subject: g++ 1.34.2 sizeof bug
Message-ID: <8909262311.AA00479@yeager>
Date: 26 Sep 89 23:11:31 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 31

%
% cat size.cc
#include 
class Int {
  private:
    int value;
    char str[20];

  public:
    Int(int i) { value = i; };
    operator()() { return value; };
};

main() {
Int a = 1, b = 2, c = 3;
Int& all[/* max_all */] = { a, b , c};
const max_all = (sizeof(all)/sizeof(Int&));

cout << "max_all's value is " << max_all << "\n";
for (int i = 0 ; i < max_all; i++)
   cout << "all[" << i << "] = " << all[i]() << "\n";
}
% g++ -v
g++ version 1.34.2
% cat /etc/motd
SunOS Release 4.0 (SQDL60) #1: Fri Mar 10 18:55:26 MST 1989
% g++ size.cc
% a.out
max_all's value is 0
%
-- should be 3, and it is if you comment out 'char str[20];'