+2017-06-19 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/81119
+ * name-lookup.c (update_binding): Only warn about constructors
+ hidden by functions.
+
2017-06-17 Jason Merrill <jason@redhat.com>
PR c++/60063 - -Wunused-local-typedefs and templates.
else
goto conflict;
+ if (to_type != old_type
+ && warn_shadow
+ && MAYBE_CLASS_TYPE_P (TREE_TYPE (to_type))
+ && !(DECL_IN_SYSTEM_HEADER (decl)
+ && DECL_IN_SYSTEM_HEADER (to_type)))
+ warning (OPT_Wshadow, "%q#D hides constructor for %q#D",
+ decl, to_type);
+
to_val = ovl_insert (decl, old);
}
else if (!old)
add_decl_to_level (level, to_add);
}
- if (to_type != old_type)
- {
- gcc_checking_assert (!old_type
- && TREE_CODE (to_type) == TYPE_DECL
- && DECL_ARTIFICIAL (to_type));
-
- tree type = TREE_TYPE (to_type);
- if (to_type != decl
- && MAYBE_CLASS_TYPE_P (type) && warn_shadow
- && (!DECL_IN_SYSTEM_HEADER (decl)
- || !DECL_IN_SYSTEM_HEADER (to_type)))
- warning (OPT_Wshadow, "%q#D hides constructor for %q#T",
- decl, type);
- }
-
if (slot)
{
if (STAT_HACK_P (*slot))
--- /dev/null
+// PR c++/81119 Wshadow regression
+// { dg-additional-options "-Wshadow" }
+
+struct A;
+typedef A A; // No warning, does not hide
+
+struct B; // { dg-message "previous" }
+typedef int B; // { dg-error "conflicting" }
+
+struct C;
+void C (); // { dg-warning "hides constructor" }
+void C (int); // warning not repeated
+
+struct D;
+int D; // no warning, not a function
+
+struct E;
+
+enum X
+ {E}; // no warning, not a function