Debian Codegraph @

gcc/testsuite/g++.dg/diagnostic/semicolon16.C

raw
1 // DR 569, Spurious semicolons at namespace scope should be allowed
2 // PR c++/113760
3 // { dg-options "-Wextra-semi -pedantic-errors" }
4
5 // C++11 allows extra semicolons at namespace scope.
6 struct S {
7 void foo();
8 };
9 ; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
10 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }
11
12 void S::foo () {
13 }; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
14 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }
15 ; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
16 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }
17
18 namespace N {
19 }; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
20 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }
21 ; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
22 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }
23
24 void f();
25 ; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
26 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }
27
28 void
29 f ()
30 {
31 }; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
32 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }
33 ; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
34 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }
35
36 int x;
37 ; // { dg-warning "extra .;. outside of a function" "" { target c++11 } }
38 // { dg-error "extra .;. outside of a function" "" { target c++98_only } .-1 }