[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
This commit is contained in:
parent
0dce552628
commit
3897f13410
@ -1,3 +1,8 @@
|
||||
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;
|
||||
|
@ -1,3 +1,8 @@
|
||||
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:
|
||||
|
20
gcc/testsuite/g++.dg/warn/pr86881.C
Normal file
20
gcc/testsuite/g++.dg/warn/pr86881.C
Normal file
@ -0,0 +1,20 @@
|
||||
// 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 *-*-* } }
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user