summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/cxx-class.cpp
diff options
context:
space:
mode:
authorCharles Li <charles_li@playstation.sony.com>2016-04-14 23:47:07 +0000
committerCharles Li <charles_li@playstation.sony.com>2016-04-14 23:47:07 +0000
commit1a88adbb27a21e7728253c2f932b41009e314985 (patch)
tree7dafdd87f8d899c1dd638dcd2bc171df4ad58706 /clang/test/Parser/cxx-class.cpp
parent4960fbf391360ae04c5815fca2fd647567a977f3 (diff)
downloadbcm5719-llvm-1a88adbb27a21e7728253c2f932b41009e314985.tar.gz
bcm5719-llvm-1a88adbb27a21e7728253c2f932b41009e314985.zip
Lit C++11 Compatibility Patch #8
24 tests have been updated for C++11 compatibility. llvm-svn: 266387
Diffstat (limited to 'clang/test/Parser/cxx-class.cpp')
-rw-r--r--clang/test/Parser/cxx-class.cpp62
1 files changed, 54 insertions, 8 deletions
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp
index 9e907f1b1c1..3cc006af23d 100644
--- a/clang/test/Parser/cxx-class.cpp
+++ b/clang/test/Parser/cxx-class.cpp
@@ -1,4 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions -std=c++11 %s
+
class C;
class C {
public:
@@ -69,11 +72,30 @@ public; // expected-error{{expected ':'}}
};
class F {
- int F1 { return 1; } // expected-error{{function definition does not declare parameters}}
- void F2 {} // expected-error{{function definition does not declare parameters}}
+ int F1 { return 1; }
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{function definition does not declare parameters}}
+#else
+ // expected-error@-4 {{expected expression}}
+ // expected-error@-5 {{expected}}
+ // expected-note@-6 {{to match this '{'}}
+ // expected-error@-7 {{expected ';' after class}}
+#endif
+
+ void F2 {}
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{function definition does not declare parameters}}
+#else
+ // expected-error@-4 {{variable has incomplete type 'void'}}
+ // expected-error@-5 {{expected ';' after top level declarator}}
+#endif
+
typedef int F3() { return 0; } // expected-error{{function definition declared 'typedef'}}
typedef void F4() {} // expected-error{{function definition declared 'typedef'}}
};
+#if __cplusplus >= 201103L
+// expected-error@-2 {{extraneous closing brace}}
+#endif
namespace ctor_error {
class Foo {};
@@ -203,14 +225,38 @@ namespace BadFriend {
}
class PR20760_a {
- int a = ); // expected-warning {{extension}} expected-error {{expected expression}}
- int b = }; // expected-warning {{extension}} expected-error {{expected expression}}
- int c = ]; // expected-warning {{extension}} expected-error {{expected expression}}
+ int a = ); // expected-error {{expected expression}}
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
+ int b = }; // expected-error {{expected expression}}
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
+ int c = ]; // expected-error {{expected expression}}
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
};
class PR20760_b {
- int d = d); // expected-warning {{extension}} expected-error {{expected ';'}}
- int e = d]; // expected-warning {{extension}} expected-error {{expected ';'}}
- int f = d // expected-warning {{extension}} expected-error {{expected ';'}}
+ int d = d); // expected-error {{expected ';'}}
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
+ int e = d]; // expected-error {{expected ';'}}
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
+ int f = d // expected-error {{expected ';'}}
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
};
namespace PR20887 {
OpenPOWER on IntegriCloud