Debian Codegraph @

gcc/testsuite/g++.dg/diagnostic/redeclaration-7.C

raw
1 // PR c++/52953
2 // { dg-do compile }
3 // { dg-options "-pedantic-errors" }
4
5 volatile int v;
6
7 void
8 baz ()
9 {
10 for (int x = v; // { dg-message "'int x' previously declared here" }
11 int x = v; ++x) // { dg-error "redeclaration of 'int x'" }
12 ;
13 for (int x = v; // { dg-message "'int x' previously declared here" }
14 int x = v; ++x) // { dg-error "redeclaration of 'int x'" }
15 { // { dg-message "'int x' previously declared here" "" { target *-*-* } .-1 }
16 int x; // { dg-error "redeclaration of 'int x'" }
17 }
18 for (int x = v; // { dg-message "'int x' previously declared here" }
19 int x = v; ++x) // { dg-error "redeclaration of 'int x'" }
20 { // { dg-message "previous declaration 'int x'" "" { target *-*-* } .-1 }
21 extern int x; // { dg-error "'int x' conflicts with a previous declaration" }
22 }
23 }