public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* typeof and private data
@ 1997-12-31  3:56 Martin von Loewis
  0 siblings, 0 replies; only message in thread
From: Martin von Loewis @ 1997-12-31  3:56 UTC (permalink / raw)
  To: egcs, egcs-bugs

The following code does compile with gcc 2.7.2, but not with egcs
(either 1.0, or 971225):

class KProcess 
{
public:
  bool normalExit();
private:
  int status;          
};
bool KProcess::normalExit()
{
  __typeof(status) foo;
  union { __typeof(  status  ) in; int i; } u;
  return false;
}

bash-2.00# g++ -v
Reading specs from /usr/lib/gcc-lib/i486-pc-linux-gnu/egcs-2.91.03/specs
gcc version egcs-2.91.03 971225 (gcc-2.8.0)
bash-2.00# g++ -c k.cc
k.cc: In method `bool KProcess::normalExit()':
k.cc:11: member `status' is a private member of class `KProcess'
k.cc:11: warning: ANSI C++ forbids declaration `in' with no type

Please note that the declaration of foo is OK; it is the declaration
of u.in which it complains about.

Is the code above correct GNU C++? If so, this is a bug in egcs.

This problem shows up when compiling KDE with glibc 2: the WIFEXITED
macro, when applied to a private member, produces the error message.

TIA,
Martin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-12-31  3:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-31  3:56 typeof and private data Martin von Loewis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).