re PR c++/92365 (ice unexpected expression ‘int16_t()’ of kind cast_expr)
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sat, 23 Nov 2019 06:33:59 +0000 (06:33 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Sat, 23 Nov 2019 06:33:59 +0000 (06:33 +0000)
PR c++/92365

2019-11-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR c++/92365
        * name-lookup.c (check_local_shadow): Use can_convert_arg
        instead of can_convert.

testsuite:
2019-11-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR c++/92365
        * g++.dg/pr92365.C: New test.

From-SVN: r278639

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr92365.C [new file with mode: 0644]

index 444b339fe57618acd5d94127a329b7dfce496a8c..33e2cfeede888b7abe424daa9579206a06be8810 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-23  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR c++/92365
+       * name-lookup.c (check_local_shadow): Use can_convert_arg
+       instead of can_convert.
+
 2019-11-22  Marek Polacek  <polacek@redhat.com>
 
        PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
index b399b4ed39dbd0bf9a9d74d47d628aadddf71024..a298b61bda9d8de34ff896a96d3f2a83a308fe75 100644 (file)
@@ -2769,8 +2769,8 @@ check_local_shadow (tree decl)
                      (now) doing the shadow checking too
                      early.  */
                   && !type_uses_auto (TREE_TYPE (decl))
-                  && can_convert (TREE_TYPE (old), TREE_TYPE (decl),
-                                  tf_none)))
+                  && can_convert_arg (TREE_TYPE (old), TREE_TYPE (decl),
+                                      decl, LOOKUP_IMPLICIT, tf_none)))
        warning_code = OPT_Wshadow_compatible_local;
       else
        warning_code = OPT_Wshadow_local;
index 1109cd65d05c436ae6366eceb31e442d3ff11afe..c34573b04dcb4ed35fe56c1d66dfe75a30efc468 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-23  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR c++/92365
+       * g++.dg/pr92365.C: New test.
+
 2019-11-22  Marek Polacek  <polacek@redhat.com>
 
        PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
diff --git a/gcc/testsuite/g++.dg/pr92365.C b/gcc/testsuite/g++.dg/pr92365.C
new file mode 100644 (file)
index 0000000..2cefd79
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR c++/92365  */
+/* { dg-options "-std=c++98 -Wshadow=compatible-local" } */
+
+class a {
+public:
+  a(char *);
+};
+void b() {
+  a c(0);
+  if (0)
+    int c;
+}