This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
2.91.40: missing features in namespaces
- To: "egcs-bugs at cygnus dot com" <egcs-bugs at cygnus dot com>
- Subject: 2.91.40: missing features in namespaces
- From: micschne at stud dot uni-frankfurt dot de
- Date: Mon, 15 Jun 1998 12:55:05 +0200 (CST)
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...