This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++: Bad C++ using-declaration semantics


> abs.cc: In function `int main ()':
> abs.cc:10: parameter type of called function is incomplete

Thanks for your bug report. Here is a patch. This patch breaks
g++.ns/overload3.C, but I believe this test case is bogus.

Jason, what was your rationale in this case?

Regards,
Martin

2000-05-19  Martin v. Löwis  <loewis@informatik.hu-berlin.de>

	* decl.c (push_using_decl): Return the old decl on namespace level.

Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.605
diff -u -r1.605 decl.c
--- decl.c	2000/05/17 08:15:28	1.605
+++ decl.c	2000/05/19 08:26:46
@@ -4386,9 +4386,10 @@
     }
 }
 
-/* Insert another USING_DECL into the current binding level,
-   returning this declaration. If this is a redeclaration,
-   do nothing and return NULL_TREE.  */
+/* Insert another USING_DECL into the current binding level, returning
+   this declaration. If this is a redeclaration, do nothing, and
+   return NULL_TREE if this not in namespace scope (in namespace
+   scope, a using decl might extend any previous bindings).  */
 
 tree
 push_using_decl (scope, name)
@@ -4403,7 +4404,7 @@
     if (DECL_INITIAL (decl) == scope && DECL_NAME (decl) == name)
       break;
   if (decl)
-    return NULL_TREE;
+    return namespace_bindings_p () ? decl : NULL_TREE;
   decl = build_lang_decl (USING_DECL, name, void_type_node);
   DECL_INITIAL (decl) = scope;
   TREE_CHAIN (decl) = current_binding_level->usings;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]