Commit 3897f134 by Nathan Sidwell Committed by Nathan Sidwell

[PATCH c++/86881] -Wshadow-local-compatible ICE

https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00984.html
	PR c++/86881
	cp/
	* name-lookup.c (check_local_shadow): Ignore auto types.

	testsuite/
	* g++.dg/warn/pr86881.C: New.

From-SVN: r264391
parent 0dce5526
2018-09-18 Nathan Sidwell <nathan@acm.org>
PR c++/86881
* name-lookup.c (check_local_shadow): Ignore auto types.
2018-09-17 David Malcolm <dmalcolm@redhat.com>
* error.c (range_label_for_type_mismatch::get_text): Update for
......
......@@ -2764,6 +2764,13 @@ check_local_shadow (tree decl)
&& (same_type_p (TREE_TYPE (old), TREE_TYPE (decl))
|| (!dependent_type_p (TREE_TYPE (decl))
&& !dependent_type_p (TREE_TYPE (old))
/* If the new decl uses auto, we don't yet know
its type (the old type cannot be using auto
at this point, without also being
dependent). This is an indication we're
(now) doing the shadow checking too
early. */
&& !type_uses_auto (TREE_TYPE (decl))
&& can_convert (TREE_TYPE (old), TREE_TYPE (decl),
tf_none))))
warning_code = OPT_Wshadow_compatible_local;
......
2018-09-18 Nathan Sidwell <nathan@acm.org>
PR c++/86881
* g++.dg/warn/pr86881.C: New.
2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/spellcheck_1.c:
......
// PR c++/86881 ICE with shadow warning
// { dg-do compile { c++11 } }
// { dg-additional-options { -Wshadow-compatible-local } }}
void a() {
auto b([] {});
{
auto b = 0;
}
}
struct Proxy { };
void Two ()
{
auto my = Proxy ();
{
auto my = Proxy (); // { dg-warning "shadows" "" { xfail *-*-* } }
};
}
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