aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorBronek Kozicki <b.kozicki@gmail.com>2013-04-01 19:04:59 +0000
committerJason Merrill <jason@gcc.gnu.org>2013-04-01 15:04:59 -0400
commit2eed8e37019cecd79d95b81ecfb6f8605b6361fa (patch)
treeb559fa7f7e6f0e57d15a631da9a9be7802955ac1 /gcc/cp/call.c
parent5bc08e85f179b65b4e8f4bb70421216805c5c6bf (diff)
downloadgcc-2eed8e37019cecd79d95b81ecfb6f8605b6361fa.zip
gcc-2eed8e37019cecd79d95b81ecfb6f8605b6361fa.tar.gz
gcc-2eed8e37019cecd79d95b81ecfb6f8605b6361fa.tar.bz2
Implement N2439 (ref-qualifiers for 'this')
Implement N2439 (ref-qualifiers for 'this') * cp-tree.h (FUNCTION_REF_QUALIFIED): New. (FUNCTION_RVALUE_QUALIFIED): New. (FUNCTION_OR_METHOD_TYPE_CHECK): New. (cpp0x_warn_str): Add CPP0X_REF_QUALIFIER. (cp_ref_qualifier): New enum. (cp_declarator): Add ref_qualifier. * parser.c (cp_parser_ref_qualifier_seq_opt): New. (cp_parser_direct_declarator): Use it. (make_call_declarator): Adjust. (cp_parser_lambda_declarator_opt): Adjust. * call.c (add_function_candidate): Handle ref-qualifier overload resolution semantics. (standard_conversion): Adjust. * class.c (add_method, same_signature_p): Compare ref-qualifiers. * decl.c (grokdeclarator): Handle ref-qualifiers. (grokfndecl): Check for invalid ref-qualifiers. (static_fn_type, revert_static_member_fn): Adjust. * decl2.c (build_memfn_type): Handle ref-qualifiers. (check_classfn): Check them. (cp_reconstruct_complex_type): Retain them. * error.c (dump_ref_qualifier): New. (dump_type_suffix, dump_function_decl): Use it. (maybe_warn_cpp0x): Handle CPP0X_REF_QUALIFIER. * pt.c (tsubst, tsubst_function_type): Instantiate ref-quals. (unify): Retain them. * tree.c (cp_check_qualified_type): New. (cp_build_qualified_type_real): Keep exception spec and ref-qual. (build_ref_qualified_type): New. (strip_typedefs, build_exception_variant): Keep ref-qualifier. (cp_build_type_attribute_variant): Keep ref-qualifier. * typeck.c (merge_types): Keep ref-qualifier. (structural_comptypes): Compare ref-qualifier. (type_memfn_rqual): New. (apply_memfn_quals): Take ref-qual argument. * typeck2.c (build_m_component_ref): Check ref-qualifier. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r197315
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 5df6b47..712bd17 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1276,7 +1276,10 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
static_fn_type (tofn)))
return NULL;
- from = build_memfn_type (fromfn, tbase, cp_type_quals (tbase));
+ from = build_memfn_type (fromfn,
+ tbase,
+ cp_type_quals (tbase),
+ type_memfn_rqual (tofn));
from = build_ptrmemfunc_type (build_pointer_type (from));
conv = build_conv (ck_pmem, from, conv);
conv->base_p = true;
@@ -1950,7 +1953,17 @@ add_function_candidate (struct z_candidate **candidates,
{
parmtype = cp_build_qualified_type
(ctype, cp_type_quals (TREE_TYPE (parmtype)));
- parmtype = build_pointer_type (parmtype);
+ if (FUNCTION_REF_QUALIFIED (TREE_TYPE (fn)))
+ {
+ /* If the function has a ref-qualifier, the implicit
+ object parameter has reference type. */
+ bool rv = FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (fn));
+ parmtype = cp_build_reference_type (parmtype, rv);
+ arg = build_fold_indirect_ref (arg);
+ argtype = lvalue_type (arg);
+ }
+ else
+ parmtype = build_pointer_type (parmtype);
}
/* Core issue 899: When [copy-]initializing a temporary to be bound