diff gcc/testsuite/gdc.test/fail_compilation/fail2195.d @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail2195.d	Mon May 25 07:50:57 2020 +0900
@@ -0,0 +1,18 @@
+// https://issues.dlang.org/show_bug.cgi?id=2195
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail2195.d(16): Deprecation: variable `variable` is shadowing variable `fail2195.main.variable`. Rename the `foreach` variable.
+---
+*/
+
+void main()
+{
+    int[int] arr;
+    int variable;
+    foreach (i, j; arr)
+    {
+        int variable;  // shadowing is disallowed but not detected
+    }
+}