On Mon, Apr 3, 2017 at 10:47 PM, Volker Reichelt
<v.reich...@netcologne.de> wrote:
> The following patch fixes a broken diagnostic:
> #'unary_plus_expr' not supported by expression#
>
> The code to handle UNARY_PLUS_EXPR is already in place in
> cxx_pretty_printer::unary_expression. However, UNARY_PLUS_EXPR
> is not checked in cxx_pretty_printer::expression, so that we
> don't call cxx_pretty_printer::unary_expression.
> Fixed with the patch below.
>
> Bootstrapped and regtested on x86_64-pc-linux-gnu.
>
> OK for trunk? Or should this wait for stage 1?

I think it's obvious and can't break anything.

Richard.

> Regards,
> Volker
>
>
> 2017-04-03  Volker Reichelt  <v.reich...@netcologne.de>
>
>         PR c++/80296
>         * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
>         UNARY_PLUS_EXPR case.
>
> Index: gcc/cp/cxx-pretty-print.c
> ===================================================================
> --- gcc/cp/cxx-pretty-print.c   (revision 246620)
> +++ gcc/cp/cxx-pretty-print.c   (working copy)
> @@ -1112,6 +1112,7 @@
>      case SIZEOF_EXPR:
>      case ALIGNOF_EXPR:
>      case NOEXCEPT_EXPR:
> +    case UNARY_PLUS_EXPR:
>        unary_expression (t);
>        break;
>
> 2017-04-03  Volker Reichelt  <v.reich...@netcologne.de>
>
>         PR c++/80296
>         * g++.dg/cpp0x/alias-decl-80296.C: New test.
>
> Index: gcc/testsuite/g++.dg/cpp0x/alias-decl-80296.C
> ===================================================================
> --- gcc/testsuite/g++.dg/cpp0x/alias-decl-80296.C       2017-04-03
> +++ gcc/testsuite/g++.dg/cpp0x/alias-decl-80296.C       2017-04-03
> @@ -0,0 +1,9 @@
> +// { dg-do compile { target c++11 } }
> +// { dg-bogus "not supported by" "" { target *-*-* } 0 }
> +
> +template <int...> struct A {};
> +
> +template <int... N> using B = A<+N...>;
> +
> +B<int> b; // { dg-error "type/value mismatch" }
> +          // { dg-message "expected a constant" "expected" { target *-*-* } 
> 8 }
> ===================================================================
>

Reply via email to