This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Parse error with scope-resolution operator
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Parse error with scope-resolution operator
- From: "Richard B. Kreckel" <kreckel at ginac dot de>
- Date: Mon, 10 Jul 2000 17:44:22 +0200 (CEST)
- Reply-To: Richard dot Kreckel at Uni-Mainz dot DE
Hello,
The following piece of code produces a parse error when run to any GCC
that I have tried so far. AFAICT it should be ok to specify the global
namespace at any place, and other compilers (SGI, Sun) indeed do accept
that code. (A simple workaround is of course to insert spaces).
class foo {
public:
foo() { n = 0; };
foo(int i) { n = i; };
int get() { return n; }
~foo() { };
private:
int n;
};
bool operator<(int l, foo r)
{ return l<r.get(); }
bool operator>(int l, foo r)
{ return l>r.get(); }
int main(void) {
// (1<::foo()) produces parse error, but should be ok, since we are
// living in the global namespace. (1>::foo()) works, however.
if (1<::foo())
return 0;
else
return 1;
}
Regards
-richy.
--
Richard Kreckel
<Richard.Kreckel@Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>