diff options
author | Jason Merrill <jason@redhat.com> | 2017-02-10 13:01:27 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-02-10 13:01:27 -0500 |
commit | c16b872c8f1e32c11bb87346835e23125fce3747 (patch) | |
tree | 92adbb6f2201de5e0d23eb724bc143eeec7db18b | |
parent | 773acd542802a69b96e00dd82b6e210de564f553 (diff) | |
download | gcc-c16b872c8f1e32c11bb87346835e23125fce3747.zip gcc-c16b872c8f1e32c11bb87346835e23125fce3747.tar.gz gcc-c16b872c8f1e32c11bb87346835e23125fce3747.tar.bz2 |
PR c++/79401 - protected inherited constructor
* call.c (enforce_access): For inheriting constructor, find a base
binfo in the path we already have.
From-SVN: r245339
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/call.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/inh-ctor25.C | 20 |
3 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5ea0c93..688a3bc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-02-10 Jason Merrill <jason@redhat.com> + + PR c++/79401 - protected inherited constructor + * call.c (enforce_access): For inheriting constructor, find a base + binfo in the path we already have. + 2017-02-10 Marek Polacek <polacek@redhat.com> PR c++/79435 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 6533214..718438c 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6420,7 +6420,8 @@ enforce_access (tree basetype_path, tree decl, tree diag_decl, accessible when used to construct an object of the corresponding base class. */ decl = strip_inheriting_ctors (decl); - basetype_path = TYPE_BINFO (DECL_CONTEXT (decl)); + basetype_path = lookup_base (basetype_path, DECL_CONTEXT (decl), + ba_any, NULL, complain); } if (!accessible_p (basetype_path, decl, true)) diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor25.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor25.C new file mode 100644 index 0000000..fcb6e84 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor25.C @@ -0,0 +1,20 @@ +// PR c++/79401 +// { dg-do compile { target c++11 } } + +class B +{ +protected: + B (int, int); +}; +class C : public B +{ +protected: + using B::B; +}; +class A : public C +{ + A (char *); +}; +A::A (char *) : C (0, 0) +{ +} |