From a47d328ff345b05eb6fec4683ac04ac939064bfc Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 27 May 2011 15:32:30 -0400 Subject: [PATCH] re PR c++/47132 ([C++0x] decltype can't deduce some operator return types when defining an auto function's return) PR c++/47132 * mangle.c (write_expression): Handle MODOP_EXPR. From-SVN: r174357 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/mangle.c | 9 +++++++++ gcc/testsuite/ChangeLog | 2 ++ gcc/testsuite/g++.dg/abi/mangle47.C | 11 +++++++++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/abi/mangle47.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7a579c6d004..9ccdee5a178 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-05-27 Jason Merrill + PR c++/47132 + * mangle.c (write_expression): Handle MODOP_EXPR. + PR c++/47277 * parser.c (cp_parser_unqualified_id): Don't check constructor_name_p for enums. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index c1f3b44e905..27ef374597e 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2599,6 +2599,15 @@ write_expression (tree expr) write_unqualified_id (fn); write_template_args (TREE_OPERAND (expr, 1)); } + else if (TREE_CODE (expr) == MODOP_EXPR) + { + enum tree_code subop = TREE_CODE (TREE_OPERAND (expr, 1)); + const char *name = (assignment_operator_name_info[(int) subop] + .mangled_name); + write_string (name); + write_expression (TREE_OPERAND (expr, 0)); + write_expression (TREE_OPERAND (expr, 2)); + } else { int i, len; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a9e31ce77fc..4c97a9f07df 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-05-27 Jason Merrill + * g++.dg/abi/mangle47.C: New. + PR c++/49176 * g++.dg/template/const5.C: New. diff --git a/gcc/testsuite/g++.dg/abi/mangle47.C b/gcc/testsuite/g++.dg/abi/mangle47.C new file mode 100644 index 00000000000..2c1b636dc05 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle47.C @@ -0,0 +1,11 @@ +// PR c++/47132 +// { dg-options -std=c++0x } +// { dg-final { scan-assembler "_Z1fIiEDToRfp_Li1EET_" } } + +template +auto f (T t) -> decltype(t |= 1); + +int main() +{ + f(1); +}