Article View: gnu.g++.bug
Article #1603reference to array
From: Ken Yap
Date: Fri, 13 Jan 1989 04:32
Date: Fri, 13 Jan 1989 04:32
63 lines
1946 bytes
1946 bytes
Problem:
Cannot handle use of reference to array. When offending lines are
commented out, assembler code for initialized data appears to be
correct. Is this fixed in 1.32? Our local maintainer is somewhat
behind.
Session log:
g++ version 1.25.1
/usr/su/lib/cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix b.cc /tmp/cca01379.cpp
GNU CPP version 1.25.1
/usr/su/lib/c++ /tmp/cca01379.cpp -quiet -dumpbase b.cc -noreg -version -o /tmp/cca01379.s
GNU C++ version 1.25.1 (68k, MIT syntax) compiled by CC.
In function int main ():
b.cc:24: cannot convert to a pointer type
b.cc:24: bad argument 1 for function `ostream::operator << (const char *)' (type was void )
b.cc:24: void value not ignored as it ought to be
b.cc:24: type conversion required for type `ostream'
b.cc:26: cannot convert to a pointer type
b.cc:26: bad argument 1 for function `ostream::operator << (const char *)' (type was void )
b.cc:26: void value not ignored as it ought to be
b.cc:26: type conversion required for type `ostream'
Version and environment:
g++ version 1.25.1
tm.h = tm-sun3.h
md = m68k.md
aux-output.c = output-m68k.c
sun 3-50, Sun Unix 3.4
Program:
#include <stream.h>
typedef int arr[10];
arr x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, };
arr& y = x;
class foo
{
public:
static const int i = 10;
static const arr& z = x;
foo();
};
main()
{
int i;
foo f;
for (i = 0; i < 10; ++i)
cout << x[i] << "\n";
for (i = 0; i < 10; ++i)
cout << y[i] << "\n";
for (i = 0; i < 10; ++i)
cout << f.z[i] << "\n";
}
Technical Details
Message-ID:
<8901130432.AA01487@ophiuchus.cs.rochester.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!CS.ROCHESTER.EDU!kenShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!CS.ROCHESTER.EDU!ken From: ken@CS.ROCHESTER.EDU (Ken Yap) Newsgroups: gnu.g++.bug Subject: reference to array Message-ID: <8901130432.AA01487@ophiuchus.cs.rochester.edu> Date: 13 Jan 89 04:32:24 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 63