public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Namespace and enums
@ 2001-03-01  7:39 Marcus A Martin
  2001-03-01 19:37 ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Marcus A Martin @ 2001-03-01  7:39 UTC (permalink / raw)
  To: Help-gcc

I am working on a project and am constrained to using "pure" RH6.1
distribution that uses the egcs 1.1.2 compiler (actually gcc 2.91.66).
However, I run into a difficult problem and am attempting to find a solution
other than "upgrade to gcc 2.95.2" which is not an option because of
customer requirements.

The problem deals with enumerations that are declared in a namespace.
Specificly, the error has to do with the namespace scoping of the enum value
sued in a default parameter in the jcTest constructor defined below. If the
macro NO_BAD is defined, everything works fine, otherwise I get the error:

foo.cpp:24: sorry, not implemented: `namespace_decl' not supported by
dump_type
foo.cpp:24: sorry, not implemented: `namespace_decl' not supported by
dump_type

Can anyone tell me what this error means? I read it as this capability is
not supported by the compiler.

Does anyone know of a valid workaround for this problem?

Thanks,

Marcus

====================== Begin Example =============
namespace jc {
  enum Bing {
    Burp,
    Blaa
    };
};

#ifndef NO_BAD
template <class T>
class jcTest {
  public:

        jcTest(T x, jc::Bing b = jc::Burp);

        T        _i;
        jc::Bing _b;
};


template <class T>
inline
jcTest<T>::jcTest(T i, jc::Bing b)
    : _i(i), _b(b)
{
}
#endif


class jcTest2 {
  public:

        jcTest2(jc::Bing b = jc::Burp);

        jc::Bing _b;
};


jcTest2::jcTest2(jc::Bing b)
    : _b(b)
{
}


int
main()
{
#ifndef NO_BAD
        jcTest<int>     m(1);
#endif
        jcTest2         n;
        return 0;
}
================================= End Example ================

--------------------------------------------------------------
A program should follow the 'Law of Least Astonishment'.
What is this law?  It is simply that the program should
 always respond to the user in the way that astonishes him least.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Namespace and enums
  2001-03-01  7:39 Namespace and enums Marcus A Martin
@ 2001-03-01 19:37 ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2001-03-01 19:37 UTC (permalink / raw)
  To: Marcus A Martin; +Cc: Help-gcc

On Mar  1, 2001, "Marcus A Martin" <shalidor@cfl.rr.com> wrote:

> foo.cpp:24: sorry, not implemented: `namespace_decl' not supported by
> dump_type

> Can anyone tell me what this error means?  I read it as this capability is
> not supported by the compiler.

Your reading is correct.

> Does anyone know of a valid workaround for this problem?

How about declaring Bing in the global namespace?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-03-01 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-01  7:39 Namespace and enums Marcus A Martin
2001-03-01 19:37 ` Alexandre Oliva

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).