2.91.40: missing features in namespaces
micschne@stud.uni-frankfurt.de
micschne@stud.uni-frankfurt.de
Mon Jun 15 03:55:00 GMT 1998
Hello World,
My C++ compiler is
gcc version egcs-2.91.40 19980608
(gcc2 ss-980502 experimental)
[1] B. Stroustrup: "The C++ Programming Language" (3rd Ed.)
I did some experiments with namespaces and
most worked pretty well. There are two things,
that are not supported:
1) namespace directives and declarations should
be allowed within a function body (s. [1] 8.2.2,
[1] 8.2.3) :
#include <iostream>
namespace ns {
int x = 5;
}
int f()
{
using namespace std; // egcs: "parse error"
using ns::x; // ditto
cout << x; // should be ok
return 0;
}
2) If we call a function `f' from namespace `ns' with
an argument `a' of type `T' declared in the same namespace,
no namespace resolution should be necessary ([1] 8.2.6) :
namespace ns {
class T { /*...*/ };
int f(const T&);
}
int g(const ns::T& a)
{
int i = f(a); // ok: implicit `ns::f(const T&)'
return f(i); // error: no `f(int)' in scope
}
Michael
--
Michael Schneider
m_schnei@cs.uni-frankfurt.de
sending M$ Windos the KILL sig...
More information about the Gcc-bugs
mailing list