PR c++/72796 - wrong resolution of scoped method call.
authorJason Merrill <jason@redhat.com>
Thu, 4 Aug 2016 16:06:09 +0000 (12:06 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 4 Aug 2016 16:06:09 +0000 (12:06 -0400)
* typeck.c (finish_class_member_access_expr): Avoid stripping
SCOPE_REF to dependent base.

From-SVN: r239136

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/g++.dg/template/dependent-base2.C [new file with mode: 0644]

index 4c2b1157dfdba5ac08f6743dc5dfbb0a10a75c94..f8de78c97fa3817b2cdb01e65893b64672f2e823 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/72796
+       * typeck.c (finish_class_member_access_expr): Avoid stripping
+       SCOPE_REF to dependent base.
+
 2016-08-04  Thomas Schwinge  <thomas@codesourcery.com>
 
        * parser.c (cp_ensure_no_oacc_routine): Improve diagnostics.
index d4bfb112a534972d7c7303a934c098e998a523d3..78d443b1abf905b1f1dd9c86d2dbcd375ca6d11c 100644 (file)
@@ -2683,7 +2683,7 @@ finish_class_member_access_expr (cp_expr object, tree name, bool template_p,
        {
        dependent:
          return build_min_nt_loc (UNKNOWN_LOCATION, COMPONENT_REF,
-                                  orig_object, name, NULL_TREE);
+                                  orig_object, orig_name, NULL_TREE);
        }
       object = build_non_dependent_expr (object);
     }
diff --git a/gcc/testsuite/g++.dg/template/dependent-base2.C b/gcc/testsuite/g++.dg/template/dependent-base2.C
new file mode 100644 (file)
index 0000000..b418832
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/72796
+// { dg-do compile { target c++11 } }
+
+struct a;
+template <int> struct b { typedef a c; };
+struct d {
+  void e(int);
+};
+struct a : d {
+  void e(int) = delete;
+};
+template <int f> struct g : b<f>::c {
+  g(int) { this->d::e(0); }
+};
+struct h : g<0> {
+  using i = g;
+  h() : i(0) {}
+};