From dc66dd888d68508cded7c5f1e2c92940d5822f52 Mon Sep 17 00:00:00 2001 From: jason Date: Sat, 20 Sep 2014 00:55:14 +0000 Subject: [PATCH] PR c++/61392 * mangle.c (write_expression): Use unresolved-name mangling for DR850 case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215414 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/mangle.c | 11 ++++++++--- gcc/cp/semantics.c | 2 +- gcc/testsuite/g++.dg/abi/mangle63.C | 11 +++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/abi/mangle63.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f5092fb14c5..2b537281e72 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-09-19 Jason Merrill + PR c++/61392 + * mangle.c (write_expression): Use unresolved-name mangling for + DR850 case. + PR c++/61465 * call.c (convert_like_real) [ck_identity]: Call mark_rvalue_use after pulling out an element from a CONSTRUCTOR. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 283983fbe02..9703d1ceb72 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2861,11 +2861,16 @@ write_expression (tree expr) { write_string (operator_name_info[(int)code].mangled_name); ob = TREE_OPERAND (ob, 0); + write_expression (ob); } - else - write_string ("dt"); + else if (!is_dummy_object (ob)) + { + write_string ("dt"); + write_expression (ob); + } + /* else, for a non-static data member with no associated object (in + unevaluated context), use the unresolved-name mangling. */ - write_expression (ob); write_member_name (TREE_OPERAND (expr, 1)); return; } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index bcf161bd921..1d81028dc21 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1685,7 +1685,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) if (object == error_mark_node) return error_mark_node; - /* DR 613: Can use non-static data members without an associated + /* DR 613/850: Can use non-static data members without an associated object in sizeof/decltype/alignof. */ if (is_dummy_object (object) && cp_unevaluated_operand == 0 && (!processing_template_decl || !current_class_ref)) diff --git a/gcc/testsuite/g++.dg/abi/mangle63.C b/gcc/testsuite/g++.dg/abi/mangle63.C new file mode 100644 index 00000000000..d6a58a35b82 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle63.C @@ -0,0 +1,11 @@ +// DR 850 makes this valid +// { dg-do compile { target c++11 } } + +template struct A +{ + int mem; + template decltype(U()+mem) f(); +}; +int i = A().f(); + +// { dg-final { scan-assembler "_ZN1AIiE1fIiEEDTplcvT__E3memEv" } } -- 2.11.4.GIT