C++: Bad C++ using-declaration semantics
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Fri May 19 01:37:00 GMT 2000
> 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;
More information about the Gcc-bugs
mailing list