PR c++/71209 - wrong error with dependent base
authorJason Merrill <jason@redhat.com>
Fri, 17 Jun 2016 16:35:33 +0000 (12:35 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 17 Jun 2016 16:35:33 +0000 (12:35 -0400)
* typeck.c (finish_class_member_access_expr): Avoid "not a base"
warning when there are dependent bases.

From-SVN: r237558

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

index 8841e15bb405f045298ed749ba808551834d4436..6b5258efa9f31b750e3020c886ead57e21c58e5c 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-17  Jason Merrill  <jason@redhat.com>
+
+       PR c++/71209
+       * typeck.c (finish_class_member_access_expr): Avoid "not a base"
+       warning when there are dependent bases.
+
 2016-06-17  Jakub Jelinek  <jakub@redhat.com>
 
        * semantics.c (handle_omp_array_sections_1): Don't ICE when
index 2ccd2dad6a14963435da11c8dfca53b9047a49e0..3704b8844738e7ca6b7cca22341c95328c5b748c 100644 (file)
@@ -2797,6 +2797,8 @@ finish_class_member_access_expr (cp_expr object, tree name, bool template_p,
            return error_mark_node;
          if (!access_path)
            {
+             if (any_dependent_bases_p (object_type))
+               goto dependent;
              if (complain & tf_error)
                error ("%qT is not a base of %qT", scope, object_type);
              return error_mark_node;
diff --git a/gcc/testsuite/g++.dg/template/dependent-base1.C b/gcc/testsuite/g++.dg/template/dependent-base1.C
new file mode 100644 (file)
index 0000000..392305b
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/71209
+
+struct A {
+  int table_clear;
+};
+
+template <typename T>
+struct B : T {
+  B() { this->A::table_clear; }
+};