From: Jason Merrill Date: Fri, 17 Jun 2016 16:35:33 +0000 (-0400) Subject: PR c++/71209 - wrong error with dependent base X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=92354dc7a9e87708bad1aac491292f5e41692a2e;p=gcc.git PR c++/71209 - wrong error with dependent base * typeck.c (finish_class_member_access_expr): Avoid "not a base" warning when there are dependent bases. From-SVN: r237558 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8841e15bb40..6b5258efa9f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-06-17 Jason Merrill + + 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 * semantics.c (handle_omp_array_sections_1): Don't ICE when diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 2ccd2dad6a1..3704b884473 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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 index 00000000000..392305b094f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-base1.C @@ -0,0 +1,10 @@ +// PR c++/71209 + +struct A { + int table_clear; +}; + +template +struct B : T { + B() { this->A::table_clear; } +};