This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-2.91.43: error for valid c++ code
- To: egcs-patches at cygnus dot com
- Subject: Re: egcs-2.91.43: error for valid c++ code
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Wed, 8 Jul 1998 23:13:01 +0200
- References: <35A0793A.4F080BB3@iconz.co.nz>
> I am not 100% sure, but I think the code below is valid C++
> code. egcs gives an error message.
The code is OK; here is a patch for egcs.
1998-07-08 Martin von Löwis <loewis@informatik.hu-berlin.de>
* init.c (build_offset_ref): Call mark_used and
convert_from_reference for namespace members.
--- /dev/null Mon Jul 18 01:46:18 1994
+++ g++.ns/ns16.C Tue Jul 7 22:05:24 1998
@@ -0,0 +1,12 @@
+class Y {
+public:
+ void operator +(int) const;
+};
+
+namespace X {
+ extern Y const& z;
+}
+
+void f(void) {
+ X::z + 1;
+}
Index: init.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/init.c,v
retrieving revision 1.51
diff -u -r1.51 init.c
--- init.c 1998/06/23 01:49:04 1.51
+++ init.c 1998/07/08 19:27:15
@@ -1538,7 +1538,11 @@
/* Handle namespace names fully here. */
if (TREE_CODE (type) == NAMESPACE_DECL)
- return lookup_namespace_name (type, name);
+ {
+ t = lookup_namespace_name (type, name);
+ mark_used (t);
+ return convert_from_reference (t);
+ }
if (type == NULL_TREE || ! is_aggr_type (type, 1))
return error_mark_node;