On Thu, Apr 23, 2020 at 5:17 PM Jason Merrill <ja...@redhat.com> wrote:
>
> On 4/23/20 4:09 PM, Patrick Palka wrote:
> > This fixes a ICE coming from mangle.c:write_expression when compiling the
> > ranges-v3 testsuite; the added testcase is a reduced reproducer of the ICE.
> >
> > Bootstrapped and regtested on x86_64-pc-linux-gnu, and also tested on the
> > cmcstl2, fmt and range-v3 libraries.  Does this look OK to commit?
>
> OK.

Is it OK to backport the same patch to the 9 branch in order to resolve PR95678?

>
> > gcc/cp/ChangeLog:> >
> >       * tree.c (zero_init_expr_p): Use uses_template_parms instead of
> >       dependent_type_p.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * g++.dg/cpp0x/dependent3.C: New test.
> > ---
> >   gcc/cp/tree.c                           |  2 +-
> >   gcc/testsuite/g++.dg/cpp0x/dependent3.C | 28 +++++++++++++++++++++++++
> >   2 files changed, 29 insertions(+), 1 deletion(-)
> >   create mode 100644 gcc/testsuite/g++.dg/cpp0x/dependent3.C
> >
> > diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
> > index 090c565c093..8840932dba2 100644
> > --- a/gcc/cp/tree.c
> > +++ b/gcc/cp/tree.c
> > @@ -4486,7 +4486,7 @@ bool
> >   zero_init_expr_p (tree t)
> >   {
> >     tree type = TREE_TYPE (t);
> > -  if (!type || dependent_type_p (type))
> > +  if (!type || uses_template_parms (type))
> >       return false;
> >     if (zero_init_p (type))
> >       return initializer_zerop (t);
> > diff --git a/gcc/testsuite/g++.dg/cpp0x/dependent3.C 
> > b/gcc/testsuite/g++.dg/cpp0x/dependent3.C
> > new file mode 100644
> > index 00000000000..caf7e1cd4a4
> > --- /dev/null
> > +++ b/gcc/testsuite/g++.dg/cpp0x/dependent3.C
> > @@ -0,0 +1,28 @@
> > +// { dg-do compile { target c++11 } }
> > +
> > +template<typename c>
> > +struct d
> > +{
> > +  using e = c;
> > +};
> > +
> > +template<class f>
> > +struct g
> > +{
> > +  using h = typename d<f>::e;
> > +
> > +  template<class i, class j>
> > +  auto operator()(i, j k) -> decltype(h{k});
> > +};
> > +
> > +template<class l>
> > +void m()
> > +{
> > +  int a[1];
> > +  l{}(a, a);
> > +}
> > +
> > +int main()
> > +{
> > +  m<g<int *>>();
> > +}
> >
>

Reply via email to