aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-01-18 17:15:32 -0500
committerJason Merrill <jason@gcc.gnu.org>2018-01-18 17:15:32 -0500
commitb4cda6a6b731193c77191feb4dd70ef1cc658f09 (patch)
treec43ba9dbd3f6cf2d16341706a5a02473d522e3f1 /gcc
parent48cdaab9d79b0046f72570fe59a4394d0e575ef2 (diff)
downloadgcc-b4cda6a6b731193c77191feb4dd70ef1cc658f09.zip
gcc-b4cda6a6b731193c77191feb4dd70ef1cc658f09.tar.gz
gcc-b4cda6a6b731193c77191feb4dd70ef1cc658f09.tar.bz2
Fix template/inherit4.C.
PR c++/83714 * search.c (any_dependent_bases_p): Handle null TREE_BINFO. * pt.c (instantiation_dependent_scope_ref_p): True if any_dependent_bases_p. From-SVN: r256866
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/cp/search.c7
-rw-r--r--gcc/testsuite/g++.dg/torture/pr83619.C2
4 files changed, 18 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9577c02..d23bfc4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2018-01-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/83714
+ * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
+ * pt.c (instantiation_dependent_scope_ref_p): True if
+ any_dependent_bases_p.
+
2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3d7d458..0296845 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -23952,6 +23952,9 @@ instantiation_dependent_scope_ref_p (tree t)
{
if (DECL_P (TREE_OPERAND (t, 1))
&& CLASS_TYPE_P (TREE_OPERAND (t, 0))
+ /* A dependent base could make a member inaccessible in the current
+ class. */
+ && !any_dependent_bases_p ()
&& accessible_in_template_p (TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1)))
return false;
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 477e9ae..920fc15 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -2612,6 +2612,13 @@ any_dependent_bases_p (tree type)
if (!type || !CLASS_TYPE_P (type) || !processing_template_decl)
return false;
+ /* If we haven't set TYPE_BINFO yet, we don't know anything about the bases.
+ Return false because in this situation we aren't actually looking up names
+ in the scope of the class, so it doesn't matter whether it has dependent
+ bases. */
+ if (!TYPE_BINFO (type))
+ return false;
+
unsigned i;
tree base_binfo;
FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (type)), i, base_binfo)
diff --git a/gcc/testsuite/g++.dg/torture/pr83619.C b/gcc/testsuite/g++.dg/torture/pr83619.C
index a5ca537..5afd3ce 100644
--- a/gcc/testsuite/g++.dg/torture/pr83619.C
+++ b/gcc/testsuite/g++.dg/torture/pr83619.C
@@ -22,7 +22,7 @@ public:
static void
c (e *g)
{
- g->c ();
+ g->c (); // { dg-message "incomplete" }
}
};
};