This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

C++ PATCH: Check non-dependent operators in using declarations


This patch fixes a typo in do_class_using_decl.  We were trying to
determine whether or not a conversion operator was dependent, but we
used IDENTIFIER_OPNAME_P, which tests for things like "operator+", not
things like "operator float".  Since TREE_TYPE of a non-conversion
operator is always NULL, we concluded all such operators were
dependent, which meant that we didn't check for their non-presence in
non-dependent base classes at template parse time.

Tested on x86_64-unknown-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

2006-02-03  Mark Mitchell  <mark@codesourcery.com>

	* name-lookup.c (do_class_using_decl): Use IDENTIFIER_TYPENAME_P,
	not IDENTIFIER_OPNAME_P.

2006-02-03  Mark Mitchell  <mark@codesourcery.com>

	* g++.dg/template/using12.C: New test.

Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c	(revision 110465)
+++ gcc/cp/name-lookup.c	(working copy)
@@ -2768,7 +2768,7 @@ do_class_using_decl (tree scope, tree na
 
   scope_dependent_p = dependent_type_p (scope);
   name_dependent_p = (scope_dependent_p 
-		      || (IDENTIFIER_OPNAME_P (name)
+		      || (IDENTIFIER_TYPENAME_P (name)
 			  && dependent_type_p (TREE_TYPE (name))));
 
   bases_dependent_p = false;
Index: gcc/testsuite/g++.dg/template/using12.C
===================================================================
--- gcc/testsuite/g++.dg/template/using12.C	(revision 0)
+++ gcc/testsuite/g++.dg/template/using12.C	(revision 0)
@@ -0,0 +1,7 @@
+struct A {
+};
+
+template <typename T>
+struct S : public A {
+  using A::operator(); // { dg-error "no member" }
+};


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