This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch C++/80296] Fix broken diagnostic: 'unary_plus_expr' not supported by expression
- From: Volker Reichelt <v dot reichelt at netcologne dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 Apr 2017 22:47:18 +0200 (CEST)
- Subject: [Patch C++/80296] Fix broken diagnostic: 'unary_plus_expr' not supported by expression
- Authentication-results: sourceware.org; auth=none
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 }
===================================================================