summaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-15 07:32:03 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-15 07:32:03 +0000
commitfa6e8832986fe3f02a3205d67728e761f0eb2c77 (patch)
tree8285868a5a9c87582ef3660e51cb5a55576cb450 /gcc/cp/name-lookup.c
parent22596ff5772afba807624c631bc7713eb9f33426 (diff)
downloadgcc-fa6e8832986fe3f02a3205d67728e761f0eb2c77.tar.gz
Implement C++11 inheriting constructors.
* cp-tree.h (cpp0x_warn_str): Add CPP0X_INHERITING_CTORS. (DECL_INHERITED_CTOR_BASE, SET_DECL_INHERITED_CTOR_BASE): New. (special_function_kind): Add sfk_inheriting_constructor. * class.c (add_method): An inheriting ctor is hidden by a user-declared one. (one_inheriting_sig, one_inherited_ctor): New. (add_implicitly_declared_members): Handle inheriting ctors. * error.c (maybe_warn_cpp0x): Handle CPP0X_INHERITING_CTORS. * init.c (emit_mem_initializers): Don't set LOOKUP_DEFAULTED for an inheriting constructor. * method.c (type_has_trivial_fn): Handle sfk_inheriting_constructor. (type_set_nontrivial_flag): Likewise. (add_one_base_init): Split out from... (do_build_copy_constructor): ...here. Handle inheriting constructors. (locate_fn_flags): Handle a list of arg types. (synthesized_method_walk): Handle inheriting constructors. (maybe_explain_implicit_delete): Likewise. (deduce_inheriting_ctor): New. (implicitly_declare_fn): Handle inheriting constructors. * name-lookup.c (push_class_level_binding_1): An inheriting constructor does not declare the base's name. (do_class_using_decl): Allow inheriting constructors. * pt.c (template_parms_to_args): Split from current_template_args. (add_inherited_template_parms): New. (tsubst_decl): Handle inheriting constructors. * tree.c (special_function_p): Handle inheriting constructors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192448 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index cd328b31c72..f0105604921 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3026,6 +3026,14 @@ push_class_level_binding_1 (tree name, tree x)
&& TREE_TYPE (decl) == error_mark_node)
decl = TREE_VALUE (decl);
+ if (TREE_CODE (decl) == USING_DECL
+ && TREE_CODE (USING_DECL_SCOPE (decl)) == TEMPLATE_TYPE_PARM
+ && DECL_NAME (decl) == TYPE_IDENTIFIER (USING_DECL_SCOPE (decl)))
+ /* This using-declaration declares constructors that inherit from the
+ constructors for the template parameter. It does not redeclare the
+ name of the template parameter. */
+ return true;
+
if (!check_template_shadow (decl))
return false;
@@ -3218,10 +3226,7 @@ do_class_using_decl (tree scope, tree name)
return NULL_TREE;
}
if (MAYBE_CLASS_TYPE_P (scope) && constructor_name_p (name, scope))
- {
- error ("%<%T::%D%> names constructor", scope, name);
- return NULL_TREE;
- }
+ maybe_warn_cpp0x (CPP0X_INHERITING_CTORS);
if (constructor_name_p (name, current_class_type))
{
error ("%<%T::%D%> names constructor in %qT",