Article View: gnu.g++.bug
Article #1443g++ bug
From: Nikolay Yatsenko
Date: Fri, 29 Jan 1993 03:14
Date: Fri, 29 Jan 1993 03:14
40 lines
2017 bytes
2017 bytes
Compile error (gcc 2.3.3, sparc), inline function in nested class.
Below is an example:
input source file, gcc 2.3.3 compiler messages.
/////////////////// Input file /////////////////////////////////////////
// ARM 9.7 Nested Class Declaration.
//
// From AT&T Annotated C++ Reference Manual, 9.7:
// "Except by using explicit pointers, references, and object names,
// declarations in a nested class can use only type names, static members,
// and enumerations from the enclosing class."
//
// This is an example from ARM $9.7.
int x;
class enclose {
public:
int x;
static int s;
class inner {
void f(int i)
{
::x = i; // Error: g++ gives error, should be OK: assign to global x.
}
};
};
///////////////// end of input file ////////////////////////////////
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
gcc version 2.3.3
/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix nested2.C /usr/tmp/cca26697.i
GNU CPP version 2.3.3 (sparc)
/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca26697.i -quiet -dumpbase nested2.cc -version -o /usr/tmp/cca26697.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
nested2.C:20: warning: all member functions in class `inner' are private
nested2.C: In method `void inner::f (int)':
nested2.C:18: assignment to non-static member `x' of enclosing class `enclose'/
Technical Details
Message-ID:
<199301272139.AA25483@world.std.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!UB.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!world.std.com!kolShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!UB.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!world.std.com!kol From: kol@world.std.com (Nikolay Yatsenko) Newsgroups: gnu.g++.bug Subject: g++ bug Date: 28 Jan 1993 22:14:28 -0500 Organization: Gnus Not Usenet Lines: 41 Sender: daemon@cis.ohio-state.edu Approved: bug-g++@prep.ai.mit.edu Distribution: gnu Message-ID: <199301272139.AA25483@world.std.com>