Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: stan@chirpa.mayo.edu (Andrew Staniszewski)
Subject: DEC C++, request for improvement ...
Date: 16 Aug 1994 16:26:13 GMT	[thread overview]
Message-ID: <32qpb5$q3f@fermat.mayo.edu> (raw)


Hi,
I ran accross a name space problem, and found differnt responses from
differnt C++ compilers.

if an enumeration is declared in the base class scope, and the name of
a derived classes matches one of the enumerated values, the compiler reports
a syntax error when the derived class has its own type as a parameter passed
 into one of its members.

It would be nice if the compiler at least warned about the name space
collision, and if it gave a more intellegint message than syntax error:

sample code:
-----------------------------------------------------------------------
class dada
{
public:
  enum blah {ahh,daaa};
};

//
// this is a terible thing to do, the class will have a name matching
// an enumeration within its own scope, this needs at least a warning.
class daaa : private dada
{
  blah a;
public:
  daaa() {a=daaa;}
};

// this has the same problem as the example above, but we get a syntax
// error because of the name confusion. The compiler should say more than 
// syntax error.
class ahh : private dada
{
public:
  ahh(const ahh &da);
};

-- 
------------------------------------------------------------------------------
Andrew Staniszewski
staniszewski@mayo.edu
" ... is everybody else going forwards,
	or are we just going backwards ??" MDE
------------------------------------------------------------------------------


                 reply	other threads:[~1994-08-16 16:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox