Commit e4f0733a by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/81640 (ICE in lookup_fnfields_slot_nolazy w/ -Wshadow=compatible-local)

	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
parent 349721b7
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.
......
......@@ -3735,7 +3735,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags,
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.
......
// 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> ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment