This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Namespace and enums
- To: "Help-gcc" <Help-gcc at gnu dot org>
- Subject: Namespace and enums
- From: "Marcus A Martin" <shalidor at cfl dot rr dot com>
- Date: Thu, 1 Mar 2001 10:41:58 -0500
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.