45 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -DPEDANTIC %s2// RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify %s3// RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify -std=c++11 %s4// RUN: cp %s %t5// RUN: %clang_cc1 -x c++ -Wextra-semi -fixit %t6// RUN: %clang_cc1 -x c++ -Wextra-semi -Werror %t7 8class A {9 void A1();10 void A2() { };11#ifndef PEDANTIC12 // This warning is only produced if we specify -Wextra-semi, and not if only13 // -pedantic is specified, since one semicolon is technically permitted.14 // expected-warning@-4{{extra ';' after member function definition}}15#endif16 void A2b() { };; // expected-warning{{extra ';' after member function definition}}17 ; // expected-warning{{extra ';' inside a class}}18 void A2c() { }19 ;20#ifndef PEDANTIC21 // expected-warning@-2{{extra ';' after member function definition}}22#endif23 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 31union B {32 int a1;33 int a2;; // expected-warning{{extra ';' inside a union}}34};35 36;37; ;;38#if __cplusplus < 201103L39// 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#endif45