diff options
Diffstat (limited to 'clang/test/Parser')
-rw-r--r-- | clang/test/Parser/cxx-class.cpp | 4 | ||||
-rw-r--r-- | clang/test/Parser/cxx-extra-semi.cpp | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp index 1b3dd41ee82..75e3fbacc46 100644 --- a/clang/test/Parser/cxx-class.cpp +++ b/clang/test/Parser/cxx-class.cpp @@ -14,9 +14,9 @@ protected: public: void m() { int l = 2; - }; + }; // expected-warning{{extra ';' after function definition}} - template<typename T> void mt(T) { }; + template<typename T> void mt(T) { } ; // expected-warning{{extra ';' inside a class}} virtual int vf() const volatile = 0; diff --git a/clang/test/Parser/cxx-extra-semi.cpp b/clang/test/Parser/cxx-extra-semi.cpp new file mode 100644 index 00000000000..35c886b63b2 --- /dev/null +++ b/clang/test/Parser/cxx-extra-semi.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify %s +// RUN: cp %s %t +// RUN: %clang_cc1 -x c++ -Wextra-semi -fixit %t +// RUN: %clang_cc1 -x c++ -Wextra-semi -Werror %t + +class A { + void A1(); + void A2() { }; // expected-warning{{extra ';' after function definition}} + ; // expected-warning{{extra ';' inside a class}} + void A3() { }; ;; // expected-warning{{extra ';' after function definition}} + ;;;;;;; // expected-warning{{extra ';' inside a class}} + ; // expected-warning{{extra ';' inside a class}} + ; ;; ; ;;; // expected-warning{{extra ';' inside a class}} + ; ; ; ; ;; // expected-warning{{extra ';' inside a class}} + void A4(); +}; + +union B { + int a1; + int a2;; // expected-warning{{extra ';' inside a union}} +}; + +; // expected-warning{{extra ';' outside of a function}} +; ;;// expected-warning{{extra ';' outside of a function}} + |