* [Patch C++/80296] Fix broken diagnostic: 'unary_plus_expr' not supported by expression
@ 2017-04-03 20:47 Volker Reichelt
2017-04-04 9:20 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Volker Reichelt @ 2017-04-03 20:47 UTC (permalink / raw)
To: gcc-patches
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?
Regards,
Volker
2017-04-03 Volker Reichelt <v.reichelt@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.reichelt@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 }
===================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch C++/80296] Fix broken diagnostic: 'unary_plus_expr' not supported by expression
2017-04-03 20:47 [Patch C++/80296] Fix broken diagnostic: 'unary_plus_expr' not supported by expression Volker Reichelt
@ 2017-04-04 9:20 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-04-04 9:20 UTC (permalink / raw)
To: Volker Reichelt; +Cc: GCC Patches
On Mon, Apr 3, 2017 at 10:47 PM, Volker Reichelt
<v.reichelt@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.reichelt@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.reichelt@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 }
> ===================================================================
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-04 9:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-03 20:47 [Patch C++/80296] Fix broken diagnostic: 'unary_plus_expr' not supported by expression Volker Reichelt
2017-04-04 9:20 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).