Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* DEC C++, request for improvement ...
@ 1994-08-16 16:26 Andrew Staniszewski
  0 siblings, 0 replies; only message in thread
From: Andrew Staniszewski @ 1994-08-16 16:26 UTC (permalink / 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
------------------------------------------------------------------------------


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

only message in thread, other threads:[~1994-08-16 16:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-08-16 16:26 DEC C++, request for improvement Andrew Staniszewski

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