1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify -DPEDANTIC %s
2 // RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify %s
3 // RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify -std=c++11 %s
4 // RUN: cp %s %t
5 // RUN: %clang_cc1 -x c++ -Wextra-semi -fixit %t
6 // RUN: %clang_cc1 -x c++ -Wextra-semi -Werror %t
7 
8 class A {
9   void A1();
A2()10   void A2() { };
11 #ifndef PEDANTIC
12   // This warning is only produced if we specify -Wextra-semi, and not if only
13   // -pedantic is specified, since one semicolon is technically permitted.
14   // expected-warning@-4{{extra ';' after member function definition}}
15 #endif
A2b()16   void A2b() { };; // expected-warning{{extra ';' after member function definition}}
17   ; // expected-warning{{extra ';' inside a class}}
A2c()18   void A2c() { }
19   ;
20 #ifndef PEDANTIC
21   // expected-warning@-2{{extra ';' after member function definition}}
22 #endif
A3()23   void A3() { };  ;; // expected-warning{{extra ';' after member function definition}}
24   ;;;;;;; // expected-warning{{extra ';' inside a class}}
25   ; // expected-warning{{extra ';' inside a class}}
26   ; ;;		 ;  ;;; // expected-warning{{extra ';' inside a class}}
27     ;  ; 	;	;  ;; // expected-warning{{extra ';' inside a class}}
28   void A4();
29 };
30 
31 union B {
32   int a1;
33   int a2;; // expected-warning{{extra ';' inside a union}}
34 };
35 
36 ;
37 ; ;;
38 #if __cplusplus < 201103L
39 // expected-warning@-3{{extra ';' outside of a function is a C++11 extension}}
40 // expected-warning@-3{{extra ';' outside of a function is a C++11 extension}}
41 #elif !defined(PEDANTIC)
42 // expected-warning@-6{{extra ';' outside of a function is incompatible with C++98}}
43 // expected-warning@-6{{extra ';' outside of a function is incompatible with C++98}}
44 #endif
45