It turned out qualify_lookup was rejecting non-decls, and hence the ordering of that call relative to other tests was significant. I've restored the relative ordering to that prior to my reimplementation of lookup_type_scope_1.

applying to trunk.

nathan
--
Nathan Sidwell
2019-06-17  Nathan Sidwell  <nat...@acm.org>

	PR c++/90754
	* name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
	checking context.

	PR c++/90754
	* g++.dg/lookup/pr90754.C: New.

Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c	(revision 272381)
+++ gcc/cp/name-lookup.c	(working copy)
@@ -6488,13 +6488,13 @@ lookup_type_scope_1 (tree name, tag_scop
 	   correctly.  */
 	if (tree type = iter->type)
-	  if ((scope != ts_current
-	       || LOCAL_BINDING_P (iter)
-	       || DECL_CONTEXT (type) == iter->scope->this_entity)
-	      && qualify_lookup (iter->type, LOOKUP_PREFER_TYPES))
-	    return iter->type;
+	  if (qualify_lookup (type, LOOKUP_PREFER_TYPES)
+	      && (scope != ts_current
+		  || LOCAL_BINDING_P (iter)
+		  || DECL_CONTEXT (type) == iter->scope->this_entity))
+	    return type;
 
-	if ((scope != ts_current
-	     || !INHERITED_VALUE_BINDING_P (iter))
-	    && qualify_lookup (iter->value, LOOKUP_PREFER_TYPES))
+	if (qualify_lookup (iter->value, LOOKUP_PREFER_TYPES)
+	    && (scope != ts_current
+		|| !INHERITED_VALUE_BINDING_P (iter)))
 	  return iter->value;
       }
Index: gcc/testsuite/g++.dg/lookup/pr90754.C
===================================================================
--- gcc/testsuite/g++.dg/lookup/pr90754.C	(revision 0)
+++ gcc/testsuite/g++.dg/lookup/pr90754.C	(working copy)
@@ -0,0 +1,11 @@
+// PR c++/90754 ICE in type lookup.
+
+class A {
+  struct COMTypeInfo;
+};
+class B {
+  struct COMTypeInfo;
+};
+class C : A, B {
+  struct COMTypeInfo;
+};

Reply via email to