aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.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/pt.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/pt.c')
-rw-r--r--gcc/cp/pt.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7f4212d..d143256 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10955,7 +10955,9 @@ tsubst_function_type (tree t,
if (TREE_CODE (t) == FUNCTION_TYPE)
{
fntype = build_function_type (return_type, arg_types);
- fntype = apply_memfn_quals (fntype, type_memfn_quals (t));
+ fntype = apply_memfn_quals (fntype,
+ type_memfn_quals (t),
+ type_memfn_rqual (t));
}
else
{
@@ -10977,6 +10979,7 @@ tsubst_function_type (tree t,
fntype = build_method_type_directly (r, return_type,
TREE_CHAIN (arg_types));
+ fntype = build_ref_qualified_type (fntype, type_memfn_rqual (t));
}
fntype = cp_build_type_attribute_variant (fntype, TYPE_ATTRIBUTES (t));
@@ -11609,7 +11612,9 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/* The type of the implicit object parameter gets its
cv-qualifiers from the FUNCTION_TYPE. */
tree memptr;
- tree method_type = build_memfn_type (type, r, type_memfn_quals (type));
+ tree method_type
+ = build_memfn_type (type, r, type_memfn_quals (type),
+ type_memfn_rqual (type));
memptr = build_ptrmemfunc_type (build_pointer_type (method_type));
return cp_build_qualified_type_real (memptr, cp_type_quals (t),
complain);
@@ -17097,10 +17102,12 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
build_function_type (TREE_TYPE (method_type),
TREE_CHAIN (TYPE_ARG_TYPES (method_type)));
- /* Extract the cv-qualifiers of the member function from the
- implicit object parameter and place them on the function
- type to be restored later. */
- fntype = apply_memfn_quals (fntype, type_memfn_quals (method_type));
+ /* Extract the cv-qualifiers and ref-qualifier of the member
+ function from the implicit object parameter and place them
+ on the function type to be restored later. */
+ fntype = apply_memfn_quals (fntype,
+ type_memfn_quals (method_type),
+ type_memfn_rqual (method_type));
return unify (tparms, targs, TREE_TYPE (parm), fntype, strict, explain_p);
}