diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-04-24 15:42:20 +0000 |
---|---|---|
committer | Paolo Carlini <paolo.carlini@oracle.com> | 2013-04-24 15:42:20 +0000 |
commit | 247db58441c47be87802522e7b743c81409a9715 (patch) | |
tree | a65d9903ccac021fd701b2ac0ebf6aa98efa8f9d /gcc/cp | |
parent | 2c80a3894197843b225a65066b96d97b804219cf (diff) |
/cp
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56970
* init.c (build_offset_ref): Add tsubst_flags_t parameter.
* semantics.c (finish_qualified_id_expr): Likewise.
(finish_id_expression): Update.
* typeck.c (cp_build_addr_expr_1): Likewise.
* pt.c (tsubst_qualified_id, resolve_nondeduced_context): Likewise.
* cp-tree.h: Update declarations.
/testsuite
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56970
* g++.dg/cpp0x/sfinae45.C: New.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@198251 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 5 | ||||
-rw-r--r-- | gcc/cp/init.c | 25 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 16 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 2 |
6 files changed, 41 insertions, 21 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 929b24bb2f9..9852bd52589 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2013-04-24 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/56970 + * init.c (build_offset_ref): Add tsubst_flags_t parameter. + * semantics.c (finish_qualified_id_expr): Likewise. + (finish_id_expression): Update. + * typeck.c (cp_build_addr_expr_1): Likewise. + * pt.c (tsubst_qualified_id, resolve_nondeduced_context): Likewise. + * cp-tree.h: Update declarations. + 2013-04-17 Jason Merrill <jason@redhat.com> DR 941 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 03751053125..b8080833bef 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5317,7 +5317,8 @@ extern tree get_type_value (tree); extern tree build_zero_init (tree, tree, bool); extern tree build_value_init (tree, tsubst_flags_t); extern tree build_value_init_noctor (tree, tsubst_flags_t); -extern tree build_offset_ref (tree, tree, bool); +extern tree build_offset_ref (tree, tree, bool, + tsubst_flags_t); extern tree build_new (vec<tree, va_gc> **, tree, tree, vec<tree, va_gc> **, int, tsubst_flags_t); @@ -5712,7 +5713,7 @@ extern void add_typedef_to_current_template_for_access_check (tree, tree, location_t); extern void check_accessibility_of_qualified_id (tree, tree, tree); extern tree finish_qualified_id_expr (tree, tree, bool, bool, - bool, bool); + bool, bool, tsubst_flags_t); extern void simplify_aggr_init_expr (tree *); extern void finalize_nrv (tree *, tree, tree); extern void note_decl_for_pch (tree); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index d6ef12330e5..11006b33f89 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1817,7 +1817,8 @@ get_type_value (tree name) @@ This function should be rewritten and placed in search.c. */ tree -build_offset_ref (tree type, tree member, bool address_p) +build_offset_ref (tree type, tree member, bool address_p, + tsubst_flags_t complain) { tree decl; tree basebinfo = NULL_TREE; @@ -1841,7 +1842,8 @@ build_offset_ref (tree type, tree member, bool address_p) type = TYPE_MAIN_VARIANT (type); if (!COMPLETE_OR_OPEN_TYPE_P (complete_type (type))) { - error ("incomplete type %qT does not have member %qD", type, member); + if (complain & tf_error) + error ("incomplete type %qT does not have member %qD", type, member); return error_mark_node; } @@ -1854,7 +1856,8 @@ build_offset_ref (tree type, tree member, bool address_p) if (TREE_CODE (member) == FIELD_DECL && DECL_C_BIT_FIELD (member)) { - error ("invalid pointer to bit-field %qD", member); + if (complain & tf_error) + error ("invalid pointer to bit-field %qD", member); return error_mark_node; } @@ -1883,10 +1886,10 @@ build_offset_ref (tree type, tree member, bool address_p) if (address_p && DECL_P (t) && DECL_NONSTATIC_MEMBER_P (t)) perform_or_defer_access_check (TYPE_BINFO (type), t, t, - tf_warning_or_error); + complain); else perform_or_defer_access_check (basebinfo, t, t, - tf_warning_or_error); + complain); if (DECL_STATIC_FUNCTION_P (t)) return t; @@ -1900,7 +1903,7 @@ build_offset_ref (tree type, tree member, bool address_p) check_accessibility_of_qualified_id in case it is a pointer to non-static member. */ perform_or_defer_access_check (TYPE_BINFO (type), member, member, - tf_warning_or_error); + complain); if (!address_p) { @@ -1932,15 +1935,17 @@ build_offset_ref (tree type, tree member, bool address_p) if (flag_ms_extensions) { PTRMEM_OK_P (member) = 1; - return cp_build_addr_expr (member, tf_warning_or_error); + return cp_build_addr_expr (member, complain); } - error ("invalid use of non-static member function %qD", - TREE_OPERAND (member, 1)); + if (complain & tf_error) + error ("invalid use of non-static member function %qD", + TREE_OPERAND (member, 1)); return error_mark_node; } else if (TREE_CODE (member) == FIELD_DECL) { - error ("invalid use of non-static data member %qD", member); + if (complain & tf_error) + error ("invalid use of non-static data member %qD", member); return error_mark_node; } return member; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5c960e064a8..c087b03140c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12055,7 +12055,7 @@ tsubst_qualified_id (tree qualified_id, tree args, expr = (finish_qualified_id_expr (scope, expr, done, address_p && PTRMEM_OK_P (qualified_id), QUALIFIED_NAME_IS_TEMPLATE (qualified_id), - /*template_arg_p=*/false)); + /*template_arg_p=*/false, complain)); } /* Expressions do not generally have reference type. */ @@ -15859,7 +15859,7 @@ resolve_nondeduced_context (tree orig_expr) { tree base = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (offset, 0))); - expr = build_offset_ref (base, expr, addr); + expr = build_offset_ref (base, expr, addr, tf_warning_or_error); } if (addr) expr = cp_build_addr_expr (expr, tf_warning_or_error); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 91ee7c6a174..d555bf7b029 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1738,7 +1738,8 @@ finish_qualified_id_expr (tree qualifying_class, bool done, bool address_p, bool template_p, - bool template_arg_p) + bool template_arg_p, + tsubst_flags_t complain) { gcc_assert (TYPE_P (qualifying_class)); @@ -1758,7 +1759,7 @@ finish_qualified_id_expr (tree qualifying_class, if (TREE_CODE (expr) == SCOPE_REF) expr = TREE_OPERAND (expr, 1); expr = build_offset_ref (qualifying_class, expr, - /*address_p=*/true); + /*address_p=*/true, complain); return expr; } @@ -1792,11 +1793,12 @@ finish_qualified_id_expr (tree qualifying_class, expr, BASELINK_ACCESS_BINFO (expr), /*preserve_reference=*/false, - tf_warning_or_error)); + complain)); else if (done) /* The expression is a qualified name whose address is not being taken. */ - expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false); + expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false, + complain); } else if (BASELINK_P (expr)) ; @@ -3233,7 +3235,8 @@ finish_id_expression (tree id_expression, decl = finish_qualified_id_expr (scope, decl, done, address_p, template_p, - template_arg_p); + template_arg_p, + tf_warning_or_error); else { tree type = NULL_TREE; @@ -3349,7 +3352,8 @@ finish_id_expression (tree id_expression, done, address_p, template_p, - template_arg_p); + template_arg_p, + tf_warning_or_error); else decl = convert_from_reference (decl); } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index e5eceb76761..e96073e60a2 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5142,7 +5142,7 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain) " Say %<&%T::%D%>", base, name); } - arg = build_offset_ref (base, fn, /*address_p=*/true); + arg = build_offset_ref (base, fn, /*address_p=*/true, complain); } /* Uninstantiated types are all functions. Taking the |