namespace problem

Martin von Loewis martin@mira.isdn.cs.tu-berlin.de
Wed Sep 23 15:16:00 GMT 1998


> Are namespaces fully implemented in egcs-1.1?  The Cygnus webpage states
> that they are, but my namespace-test program below does not compile. 

Thanks for your bug report. egcs 1.1 has a hack where namespace std is
ignored. Unfortunately, it also ignores using declarations involving
std, instead of interpreting them as 'using ::string'. Here is a patch.

Martin

1998-09-23  Martin von Löwis  <loewis@informatik.hu-berlin.de>

	* decl2.c (validate_nonmember_using_decl): Fix using-directives of
	std if std is ignored.

Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.133
diff -c -p -r1.133 decl2.c
*************** validate_nonmember_using_decl (decl, sco
*** 4716,4723 ****
  {
    if (TREE_CODE (decl) == SCOPE_REF
        && TREE_OPERAND (decl, 0) == std_node)
!     return NULL_TREE;
!   if (TREE_CODE (decl) == SCOPE_REF)
      {
        *scope = TREE_OPERAND (decl, 0);
        *name = TREE_OPERAND (decl, 1);
--- 4739,4749 ----
  {
    if (TREE_CODE (decl) == SCOPE_REF
        && TREE_OPERAND (decl, 0) == std_node)
!     {
!       *scope = global_namespace;
!       *name = TREE_OPERAND (decl, 1);
!     }
!   else if (TREE_CODE (decl) == SCOPE_REF)
      {
        *scope = TREE_OPERAND (decl, 0);
        *name = TREE_OPERAND (decl, 1);




More information about the Gcc-bugs mailing list