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