Commit 9db84ece by Nathan Sidwell Committed by Nathan Sidwell

[PR c++/82424] Dont convert dependent types

https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00385.html
	cp/
	PR c++/82424
	* name-lookup.c (check_local_shadow): Don't try and convert
	dependent types.

	testsuite/
	PR c++/82424
	* g++.dg/warn/pr82424.C: New.

From-SVN: r253496
parent 7260f6f7
2017-10-06 Nathan Sidwell <nathan@acm.org>
PR c++/82424
* name-lookup.c (check_local_shadow): Don't try and convert
dependent types.
2017-10-06 Jakub Jelinek <jakub@redhat.com>
PR c++/82299
......
......@@ -2728,7 +2728,11 @@ check_local_shadow (tree decl)
else if (warn_shadow_local)
warning_code = OPT_Wshadow_local;
else if (warn_shadow_compatible_local
&& can_convert (TREE_TYPE (old), TREE_TYPE (decl), tf_none))
&& (same_type_p (TREE_TYPE (old), TREE_TYPE (decl))
|| (!dependent_type_p (TREE_TYPE (decl))
&& !dependent_type_p (TREE_TYPE (old))
&& can_convert (TREE_TYPE (old), TREE_TYPE (decl),
tf_none))))
warning_code = OPT_Wshadow_compatible_local;
else
return;
......
2017-10-06 Nathan Sidwell <nathan@acm.org>
PR c++/82424
* g++.dg/warn/pr82424.C: New.
2017-10-06 Jakub Jelinek <jakub@redhat.com>
PR c++/82299
......
// { dg-additional-options "-Wshadow=compatible-local" }
// pr c++/82424 we were trying to convert between dependent types.
template <typename T> class a
{
struct b;
template <typename, typename> void c ();
};
template <typename T>
template <typename, typename>
void
a<T>::c ()
{
typedef typename T::b b; // Don't go looking inside the typename
T thing;
{
T thing; // { dg-warning "shadows a previous local" }
}
}
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