This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, C++, PR65882] Check tf_warning flag in build_new_op_1


On Wed, Jun 24, 2015 at 09:28:34PM +0100, Mikhail Maltsev wrote:
> On 06/24/2015 06:52 PM, Christophe Lyon wrote:
> > Hi Mikhail,
> > 
> > In the gcc-5-branch, I can see that your new inhibit-warn-2.C test
> > fails (targets ARM and AArch64).
> > 
> > I can see this error message in g++.log:
> > /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C:
> > In function 'void fn1()':
> > /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C:29:3:
> > error: 'typename A<(F<typename C< <template-parameter-1-1>
> >> ::type>::value || B:: value)>::type D::operator=(Expr) [with Expr =
> > int; typename A<(F<typename C< <template-parameter-1-1>
> >> ::type>::value || B:: value)>::type = int]' is private
> > /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C:35:7:
> > error: within this context
> > 
> > Christophe.
> > 
> Oops. Sorry for that, it seems that I messed up with my testing box and
> the backport did not actually get regtested :(.
> 
> The problem is caused by difference in wording of diagnostics. GCC 6
> gives an error on line 35 and a note on line 29:
> 
> $ ./cc1plus ~/gcc/src/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C
>  void fn1()
> /home/miyuki/gcc/src/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C:35:7:
> error: 'typename A<(F<typename C< <template-parameter-1-1>
> >::type>::value || B:: value)>::type D::operator=(Expr) [with Expr =
> int; typename A<(F<typename C< <template-parameter-1-1> >::type>::value
> || B:: value)>::type = int]' is private within this context
>    opt = 0;
> /home/miyuki/gcc/src/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C:29:3:
> note: declared private here
>    operator=(Expr);
> 
> GCC 5 gives two errors:
> 
> /home/miyuki/gcc/src/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C:29:3:
> error: 'typename A<(F<typename C< <template-parameter-1-1>
> >::type>::value || B:: value)>::type D::operator=(Expr) [with Expr =
> int; typename A<(F<typename C< <template-parameter-1-1> >::type>::value
> || B:: value)>::type = int]' is private
>    operator=(Expr);
> /home/miyuki/gcc/src/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C:35:7:
> error: within this context
>    opt = 0;
> 
> It can probably be fixed like this:
> 
> diff --git a/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C
> b/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C
> index cb16b4c..f658c1d 100644
> --- a/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C
> +++ b/gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C
> @@ -26,11 +26,11 @@ class D
>  {
>    template <class Expr>
>    typename A<F<typename C<Expr>::type>::value || B::value>::type
> -  operator=(Expr); // { dg-message "declared" }
> +  operator=(Expr); // { dg-message "private" }
>  };
> 
>  void fn1()
>  {
>    D opt;
> -  opt = 0; // { dg-error "private" }
> +  opt = 0; // { dg-error "this context" }
>  }
> 
> But I am not sure, what should I do in this case. Maybe it is better to
> remove the failing testcase from GCC 5 branch (provided that
> inhibit-warn-1.C tests a fix for the same bug and does not fail)?

Your fix looks sensible to me, and I'd like to see it applied before
the 5.2 cut. Hopefully someone with the authority to OK the fixup will
be along shortly!

Thanks,
James



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]