PR c++/81640
* call.c (build_user_type_conversion_1): Only call
lookup_fnfields_slot if totype is CLASS_TYPE_P.
* g++.dg/warn/Wshadow-compatible-local-2.C: New test.
From-SVN: r250816
+2017-08-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81640
+ * call.c (build_user_type_conversion_1): Only call
+ lookup_fnfields_slot if totype is CLASS_TYPE_P.
+
2017-07-31 Jason Merrill <jason@redhat.com>
* decl.c (declare_global_var): Set DECL_CONTEXT.
gcc_assert (!MAYBE_CLASS_TYPE_P (fromtype) || !MAYBE_CLASS_TYPE_P (totype)
|| !DERIVED_FROM_P (totype, fromtype));
- if (MAYBE_CLASS_TYPE_P (totype))
+ if (CLASS_TYPE_P (totype))
/* Use lookup_fnfields_slot instead of lookup_fnfields to avoid
creating a garbage BASELINK; constructors can't be inherited. */
ctors = lookup_fnfields_slot (totype, complete_ctor_identifier);
2017-08-02 Jakub Jelinek <jakub@redhat.com>
+ PR c++/81640
+ * g++.dg/warn/Wshadow-compatible-local-2.C: New test.
+
PR middle-end/79499
* gcc.dg/pr79499.c: New test.
--- /dev/null
+// PR c++/81640
+// { dg-do compile }
+// { dg-options "-Wshadow=compatible-local" }
+
+struct A {};
+struct B { operator bool () const { return true; } };
+
+template <typename T>
+void
+foo ()
+{
+ T d, e;
+ if (e)
+ A d;
+}
+
+void
+bar ()
+{
+ foo <B> ();
+}