diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2012-09-05 10:14:37 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-09-05 10:14:37 +0000 |
commit | 22854930b945f09487ca7947326d741ff6328377 (patch) | |
tree | 2f95f089c2fa4d79dab5770ad9a8b5fa4956d54b /gcc/cp/search.c | |
parent | b588ae3074e258f5c736034c212e7499a565746f (diff) | |
download | gcc-22854930b945f09487ca7947326d741ff6328377.zip gcc-22854930b945f09487ca7947326d741ff6328377.tar.gz gcc-22854930b945f09487ca7947326d741ff6328377.tar.bz2 |
re PR c++/54191 ([C++11] SFINAE does not handle conversion to inaccessible base)
/cp
2012-09-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54191
* search.c (lookup_base): Add tsubst_flags_t parameter.
(adjust_result_of_qualified_name_lookup, check_final_overrider):
Adjust.
* name-lookup.c (do_class_using_decl): Adjust.
* typeck2.c (binfo_or_else, build_scoped_ref, build_m_component_ref):
Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_pointer_force,
build_up_reference): Likewise.
* rtti.c (build_dynamic_cast_1): Likewise.
* tree.c (maybe_dummy_object): Likewise.
* call.c (build_conditional_expr_1, build_over_call): Likewise.
* cp-tree.h (UNIQUELY_DERIVED_FROM_P, PUBLICLY_UNIQUELY_DERIVED_P):
Remove.
(enum base_access_flags, ba_quiet): Remove.
(uniquely_derived_from_p, publicly_uniquely_derived_p): Declare.
* except.c (can_convert_eh): Adjust.
* decl.c (grokdeclarator): Likewise.
* typeck.c (comp_except_types, build_class_member_access_expr,
finish_class_member_access_expr, get_member_function_from_ptrfunc,
build_static_cast_1, get_delta_difference_1): Likewise.
* class.c (build_base_path, convert_to_base, build_vtbl_ref_1,
warn_about_ambiguous_bases): Likewise.
(uniquely_derived_from_p, publicly_uniquely_derived_p): Define.
/testsuite
2012-09-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54191
* g++.dg/cpp0x/sfinae39.C: New.
From-SVN: r190969
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r-- | gcc/cp/search.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c index dc802e4..7d358ef 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -179,13 +179,13 @@ accessible_base_p (tree t, tree base, bool consider_local_p) non-NULL, fill with information about what kind of base we discovered. - If the base is inaccessible, or ambiguous, and the ba_quiet bit is - not set in ACCESS, then an error is issued and error_mark_node is - returned. If the ba_quiet bit is set, then no error is issued and - NULL_TREE is returned. */ + If the base is inaccessible, or ambiguous, then error_mark_node is + returned. If the tf_error bit of COMPLAIN is not set, no error + is issued. */ tree -lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) +lookup_base (tree t, tree base, base_access access, + base_kind *kind_ptr, tsubst_flags_t complain) { tree binfo; tree t_binfo; @@ -251,11 +251,9 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) break; case bk_ambig: - if (!(access & ba_quiet)) - { - error ("%qT is an ambiguous base of %qT", base, t); - binfo = error_mark_node; - } + if (complain & tf_error) + error ("%qT is an ambiguous base of %qT", base, t); + binfo = error_mark_node; break; default: @@ -269,13 +267,9 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) && COMPLETE_TYPE_P (base) && !accessible_base_p (t, base, !(access & ba_ignore_scope))) { - if (!(access & ba_quiet)) - { - error ("%qT is an inaccessible base of %qT", base, t); - binfo = error_mark_node; - } - else - binfo = NULL_TREE; + if (complain & tf_error) + error ("%qT is an inaccessible base of %qT", base, t); + binfo = error_mark_node; bk = bk_inaccessible; } break; @@ -1537,14 +1531,13 @@ adjust_result_of_qualified_name_lookup (tree decl, or ambiguity -- in either case, the choice of a static member function might make the usage valid. */ base = lookup_base (context_class, qualifying_scope, - ba_unique | ba_quiet, NULL); - if (base) + ba_unique, NULL, tf_none); + if (base && base != error_mark_node) { BASELINK_ACCESS_BINFO (decl) = base; BASELINK_BINFO (decl) = lookup_base (base, BINFO_TYPE (BASELINK_BINFO (decl)), - ba_unique | ba_quiet, - NULL); + ba_unique, NULL, tf_none); } } @@ -1875,12 +1868,13 @@ check_final_overrider (tree overrider, tree basefn) /* Strictly speaking, the standard requires the return type to be complete even if it only differs in cv-quals, but that seems like a bug in the wording. */ - if (!same_type_ignoring_top_level_qualifiers_p (base_return, over_return)) + if (!same_type_ignoring_top_level_qualifiers_p (base_return, + over_return)) { tree binfo = lookup_base (over_return, base_return, - ba_check | ba_quiet, NULL); + ba_check, NULL, tf_none); - if (!binfo) + if (!binfo || binfo == error_mark_node) fail = 1; } } |