aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-local-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-local-1.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-local-1.C35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-local-1.C b/gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-local-1.C
new file mode 100644
index 000000000..24a5bc223
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/warn/Wshadow-local-1.C
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options -Wshadow-local } */
+
+struct status
+{
+ int member;
+ void foo2 ();
+
+ inline static int foo3 (int member)
+ {
+ return member;
+ }
+};
+
+int decl1; // { dg-bogus "shadowed declaration" }
+int decl2; // { dg-bogus "shadowed declaration" }
+void foo (struct status &status,
+ double decl1) // { dg-bogus "shadows a global" }
+{
+}
+
+void foo1 (int d)
+{
+ double d; // { dg-error "shadows a parameter" }
+}
+
+void status::foo2 ()
+{
+ int member; // { dg-bogus "shadows a member" }
+ int decl2; // { dg-bogus "shadows a global" }
+ int local; // { dg-warning "shadowed declaration" }
+ {
+ int local; // { dg-warning "shadows a previous local" }
+ }
+}