* class.c (finish_struct): Call add_method here for function usings.
* semantics.c (finish_member_declaration): Not here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183304
138bc75d-0d04-0410-961f-
82ee72b054a4
+2012-01-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/51889
+ * class.c (finish_struct): Call add_method here for function usings.
+ * semantics.c (finish_member_declaration): Not here.
+
2012-01-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51225
if (DECL_PURE_VIRTUAL_P (x))
VEC_safe_push (tree, gc, CLASSTYPE_PURE_VIRTUALS (t), x);
complete_vars (t);
+ /* We need to add the target functions to the CLASSTYPE_METHOD_VEC if
+ an enclosing scope is a template class, so that this function be
+ found by lookup_fnfields_1 when the using declaration is not
+ instantiated yet. */
+ for (x = TYPE_FIELDS (t); x; x = DECL_CHAIN (x))
+ if (TREE_CODE (x) == USING_DECL)
+ {
+ tree fn = strip_using_decl (x);
+ if (is_overloaded_fn (fn))
+ for (; fn; fn = OVL_NEXT (fn))
+ add_method (t, OVL_CURRENT (fn), x);
+ }
/* Remember current #pragma pack value. */
TYPE_PRECISION (t) = maximum_field_alignment;
{
if (TREE_CODE (decl) == USING_DECL)
{
- /* We need to add the target functions to the
- CLASSTYPE_METHOD_VEC if an enclosing scope is a template
- class, so that this function be found by lookup_fnfields_1
- when the using declaration is not instantiated yet. */
-
- tree target_decl = strip_using_decl (decl);
- if (dependent_type_p (current_class_type)
- && is_overloaded_fn (target_decl))
- {
- tree t = target_decl;
- for (; t; t = OVL_NEXT (t))
- add_method (current_class_type, OVL_CURRENT (t), decl);
- }
-
/* For now, ignore class-scope USING_DECLS, so that
debugging backends do not see them. */
DECL_IGNORED_P (decl) = 1;
+2012-01-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/51889
+ * g++.dg/inherit/using7.C: New.
+
2012-01-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37997
--- /dev/null
+// PR c++/51889
+
+struct A {
+ void f();
+};
+
+template <class T>
+struct B: A
+{
+ using A::f;
+ void f();
+};