This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
C++: Bad C++ using-declaration semantics
- To: gcc-bugs at gcc dot gnu dot org, ncm at cantrip dot org
- Subject: C++: Bad C++ using-declaration semantics
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Fri, 19 May 2000 10:30:34 +0200
- CC: gcc-patches at gcc dot gnu dot org, jason at cygnus dot com
- References: <20000518211452.A19353@store.zembu.com>
> 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;