Patchwork [C++,/,RFC] PR 46206

login
register
mail settings
Submitter Paolo Carlini
Date Aug. 6, 2013, 4:35 p.m.
Message ID <520125D5.5090600@oracle.com>
Download mbox | patch
Permalink /patch/265164/
State New
Headers show

Comments

Paolo Carlini - Aug. 6, 2013, 4:35 p.m.
... today I did the following: commented out the error at issue 
(decl.c:11828) and ran the testsuite. The attached js.txt is the list of 
fails. Wanted to make sure that we have enough coverage.

I'm also attaching here the complete patch + testcase which passes boot 
& test.

Thanks!
Paolo.

///////////////////
FAIL: g++.dg/cpp0x/gen-attrs-27.C -std=c++11  (test for errors, line 6)
FAIL: g++.dg/ext/attrib27.C -std=c++98  (test for errors, line 5)
FAIL: g++.dg/ext/attrib27.C -std=c++11  (test for errors, line 5)
FAIL: g++.dg/lookup/struct1.C -std=c++98  (test for errors, line 6)
FAIL: g++.dg/lookup/struct1.C -std=c++98  (test for errors, line 9)
FAIL: g++.dg/lookup/struct1.C -std=c++11  (test for errors, line 6)
FAIL: g++.dg/lookup/struct1.C -std=c++11  (test for errors, line 9)
FAIL: g++.dg/parse/elab1.C -std=c++98  (test for errors, line 6)
FAIL: g++.dg/parse/elab1.C -std=c++11  (test for errors, line 6)
FAIL: g++.dg/parse/typedef3.C -std=c++98  (test for errors, line 7)
FAIL: g++.dg/parse/typedef3.C -std=c++11  (test for errors, line 7)
FAIL: g++.dg/template/crash26.C -std=c++98  (test for errors, line 8)
FAIL: g++.dg/template/crash26.C -std=c++11  (test for errors, line 8)

FAIL: g++.old-deja/g++.benjamin/typedef01.C -std=c++98  (test for errors, line 22)
FAIL: g++.old-deja/g++.benjamin/typedef01.C -std=c++11  (test for errors, line 22)
FAIL: g++.old-deja/g++.brendan/line1.C -std=c++98  (test for errors, line 4)
FAIL: g++.old-deja/g++.brendan/line1.C -std=c++11  (test for errors, line 4)

Patch

Index: cp/name-lookup.c
===================================================================
--- cp/name-lookup.c	(revision 201524)
+++ cp/name-lookup.c	(working copy)
@@ -4740,11 +4740,11 @@  lookup_name_real_1 (tree name, int prefer_type, in
 	  continue;
 
 	/* If this is the kind of thing we're looking for, we're done.  */
-	if (qualify_lookup (iter->value, flags))
+	if ((flags & LOOKUP_PREFER_TYPES)
+	    && qualify_lookup (iter->type, flags))
+	  binding = iter->type;
+	else if (qualify_lookup (iter->value, flags))
 	  binding = iter->value;
-	else if ((flags & LOOKUP_PREFER_TYPES)
-		 && qualify_lookup (iter->type, flags))
-	  binding = iter->type;
 	else
 	  binding = NULL_TREE;
 
Index: testsuite/g++.dg/parse/typedef10.C
===================================================================
--- testsuite/g++.dg/parse/typedef10.C	(revision 0)
+++ testsuite/g++.dg/parse/typedef10.C	(working copy)
@@ -0,0 +1,20 @@ 
+// PR c++/46206
+
+class Foo1
+{
+  int u, v, w, x;
+  typedef struct Bar { } Bar;
+  virtual void foo(void) {
+    struct Bar bar;
+  }
+};
+
+class Foo2
+{
+  int u, v, w;
+  typedef struct Bar { } Bar;
+  Bar bar;
+  virtual void foo(void) {
+    struct Bar bar;
+  }
+};