tigerleapgorge updated this revision to Diff 81817.
tigerleapgorge added a comment.
Previous update contain typos in the RUN lines of
test/SemaCXX/virtual-base-used.cpp
This has been corrected in this latest revision.
https://reviews.llvm.org/D21626
Files:
test/Modules/Inputs/merge-using-decls/a.h
test/Modules/Inputs/merge-using-decls/b.h
test/Modules/merge-using-decls.cpp
test/OpenMP/declare_reduction_messages.cpp
test/OpenMP/openmp_check.cpp
test/SemaCXX/MicrosoftExtensions.cpp
test/SemaCXX/PR9572.cpp
test/SemaCXX/default-assignment-operator.cpp
test/SemaCXX/default-constructor-initializers.cpp
test/SemaCXX/format-strings.cpp
test/SemaCXX/printf-cstr.cpp
test/SemaCXX/virtual-base-used.cpp
test/SemaCXX/warn-thread-safety-parsing.cpp
Index: test/SemaCXX/warn-thread-safety-parsing.cpp
===================================================================
--- test/SemaCXX/warn-thread-safety-parsing.cpp
+++ test/SemaCXX/warn-thread-safety-parsing.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s
#define LOCKABLE __attribute__ ((lockable))
#define SCOPED_LOCKABLE __attribute__ ((scoped_lockable))
@@ -1266,8 +1268,10 @@
void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { }
void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu);
- static void foo5() EXCLUSIVE_LOCKS_REQUIRED(mu); // \
- // expected-error {{invalid use of member 'mu' in static member function}}
+ static void foo5() EXCLUSIVE_LOCKS_REQUIRED(mu);
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{invalid use of member 'mu' in static member function}}
+#endif
template <class T>
void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { }
@@ -1461,15 +1465,21 @@
mutable Mutex mu;
int a GUARDED_BY(mu);
- static int si GUARDED_BY(mu); // \
- // expected-error {{invalid use of non-static data member 'mu'}}
+ static int si GUARDED_BY(mu);
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{invalid use of non-static data member 'mu'}}
+#endif
- static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \
- // expected-error {{invalid use of member 'mu' in static member function}}
+ static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu);
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{invalid use of member 'mu' in static member function}}
+#endif
friend FooStream& operator<<(FooStream& s, const Foo& f)
- EXCLUSIVE_LOCKS_REQUIRED(mu); // \
- // expected-error {{invalid use of non-static data member 'mu'}}
+ EXCLUSIVE_LOCKS_REQUIRED(mu);
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{invalid use of non-static data member 'mu'}}
+#endif
};
Index: test/SemaCXX/virtual-base-used.cpp
===================================================================
--- test/SemaCXX/virtual-base-used.cpp
+++ test/SemaCXX/virtual-base-used.cpp
@@ -1,89 +1,215 @@
// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -triple %itanium_abi_triple -verify -std=c++11 %s
// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -triple %ms_abi_triple -DMSABI -verify -std=c++11 %s
// PR7800
// The Microsoft ABI doesn't have the concept of key functions, so we have different
// expectations about when functions are first required for that case.
+class NoDestroy { ~NoDestroy(); };
+#if __cplusplus <= 199711L
+// expected-note@-2 3 {{declared private here}}
#ifdef MSABI
-// expected-note@+2 3 {{declared private here}}
+// expected-note@-4 3 {{declared private here}}
#endif
-class NoDestroy { ~NoDestroy(); }; // expected-note 3 {{declared private here}}
+#endif
+
struct A {
virtual ~A();
+#if __cplusplus >= 201103L
+ // expected-note@-2 3 {{overridden virtual function is here}}
+#endif
};
+struct B : public virtual A {
+#if __cplusplus >= 201103L
+// expected-error@-2 {{deleted function '~B' cannot override a non-deleted function}}
+// expected-note@-3 {{overridden virtual function is here}}
+#endif
+
+ NoDestroy x;
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
#ifdef MSABI
-// expected-error@+3 {{field of type 'NoDestroy' has private destructor}}
+ // expected-error@-4 {{field of type 'NoDestroy' has private destructor}}
#endif
-struct B : public virtual A {
- NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
-};
+#else
+ // expected-note@-7 {{destructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}}
#ifdef MSABI
-// expected-note@+3 {{implicit default constructor for 'B' first required here}}
-// expected-note@+2 {{implicit destructor for 'B' first required here}}
+ // expected-note@-9 {{default constructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}}
+#endif
#endif
+};
+
struct D : public virtual B {
+#if __cplusplus <= 199711L
+#ifdef MSABI
+// expected-note@-3 {{implicit default constructor for 'B' first required here}}
+// expected-note@-4 {{implicit destructor for 'B' first required here}}
+#endif
+#else
+#ifdef MSABI
+// expected-note@-8 {{default constructor of 'D' is implicitly deleted because base class 'B' has a deleted default constructor}}
+#endif
+#endif
virtual void foo();
~D();
+#if __cplusplus >= 201103L
+ //expected-error@-2 {{non-deleted function '~D' cannot override a deleted function}}
+#endif
};
+
#ifdef MSABI
-D d; // expected-note {{implicit default constructor for 'D' first required here}}
+D d;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit default constructor for 'D' first required here}}
#else
-void D::foo() { // expected-note {{implicit destructor for 'B' first required here}}
+// expected-error@-4 {{call to implicitly-deleted default constructor of 'D'}}
+#endif
+#else
+void D::foo() {
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor for 'B' first required here}}
+#endif
}
#endif
+struct E : public virtual A {
+#if __cplusplus >= 201103L
+// expected-error@-2 {{deleted function '~E' cannot override a non-deleted function}}
+// expected-note@-3 {{overridden virtual function is here}}
+#endif
+
+ NoDestroy x;
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
#ifdef MSABI
-// expected-error@+3 {{field of type 'NoDestroy' has private destructor}}
+ // expected-error@-4 {{field of type 'NoDestroy' has private destructor}}
#endif
-struct E : public virtual A {
- NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
-};
+#else
+ // expected-note@-7 {{destructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor}}
#ifdef MSABI
-// expected-note@+2 {{implicit default constructor for 'E' first required here}}
+ // expected-note@-9 {{default constructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor}}
+#endif
#endif
-struct F : public E { // expected-note {{implicit destructor for 'E' first required here}}
};
+
+struct F : public E {
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor for 'E' first required here}}
#ifdef MSABI
-// expected-note@+2 {{implicit default constructor for 'F' first required here}}
+// expected-note@-4 {{implicit default constructor for 'E' first required here}}
+#endif
+#else
+// expected-error@-7 {{non-deleted function '~F' cannot override a deleted function}}
+// expected-note@-8 {{overridden virtual function is here}}
+#ifdef MSABI
+// expected-note@-10 {{default constructor of 'F' is implicitly deleted because base class 'E' has a deleted default constructor}}
+#endif
#endif
+};
+
+
struct G : public virtual F {
+#ifdef MSABI
+#if __cplusplus <= 199711L
+// expected-note@-3 {{implicit default constructor for 'F' first required here}}
+#else
+// expected-note@-5 {{default constructor of 'G' is implicitly deleted because base class 'F' has a deleted default constructor}}
+#endif
+#endif
+
virtual void foo();
~G();
+#if __cplusplus >= 201103L
+ //expected-error@-2 {{non-deleted function '~G' cannot override a deleted function}}
+#endif
};
+
#ifdef MSABI
-G g; // expected-note {{implicit default constructor for 'G' first required here}}
+G g;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit default constructor for 'G' first required here}}
+#else
+// expected-error@-4 {{call to implicitly-deleted default constructor of 'G'}}
+#endif
#else
-void G::foo() { // expected-note {{implicit destructor for 'F' first required here}}
+void G::foo() {
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor for 'F' first required here}}
+#endif
}
#endif
+struct H : public virtual A {
+#if __cplusplus >= 201103L
+// expected-error@-2 {{deleted function '~H' cannot override a non-deleted function}}
+// expected-note@-3 {{overridden virtual function is here}}
+#else
#ifdef MSABI
-// expected-note@+3 {{'H' declared here}}
-// expected-error@+3 {{field of type 'NoDestroy' has private destructor}}
+// expected-note@-6 {{'H' declared here}}
#endif
-struct H : public virtual A {
- NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
-};
+#endif
+
+ NoDestroy x;
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
#ifdef MSABI
-// expected-error@+3 {{implicit default constructor for 'I' must explicitly initialize the base class 'H' which does not have a default constructor}}
-// expected-note@+2 {{implicit destructor for 'H' first required here}}
+ // expected-error@-4 {{field of type 'NoDestroy' has private destructor}}
+#endif
+#else
+ // expected-note@-7 {{destructor of 'H' is implicitly deleted because field 'x' has an inaccessible destructor}}
+#ifdef MSABI
+ // expected-note@-9 {{default constructor of 'H' is implicitly deleted because field 'x' has an inaccessible destructor}}
+#endif
#endif
+};
+
struct I : public virtual H {
+#ifdef MSABI
+#if __cplusplus <= 199711L
+// expected-error@-3 {{implicit default constructor for 'I' must explicitly initialize the base class 'H' which does not have a default constructor}}
+// expected-note@-4 {{implicit destructor for 'H' first required here}}
+#else
+// expected-note@-6 {{default constructor of 'I' is implicitly deleted because base class 'H' has a deleted default constructor}}
+#endif
+#endif
+
~I();
+#if __cplusplus >= 201103L
+// expected-error@-2 {{non-deleted function '~I' cannot override a deleted function}}
+#endif
};
+
+struct J : public I {
#ifdef MSABI
-// expected-note@+3 {{implicit default constructor for 'H' first required here}}
-// expected-note@+2 {{implicit default constructor for 'I' first required here}}
+#if __cplusplus <= 199711L
+// expected-note@-3 {{implicit default constructor for 'H' first required here}}
+// expected-note@-4 {{implicit default constructor for 'I' first required here}}
+#else
+// expected-note@-6 {{default constructor of 'J' is implicitly deleted because base class 'I' has a deleted default constructor}}
#endif
-struct J : public I {
+#endif
+
virtual void foo();
~J();
};
+
#ifdef MSABI
-J j; // expected-note {{implicit default constructor for 'J' first required here}}
+J j;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit default constructor for 'J' first required here}}
#else
-void J::foo() { // expected-note {{implicit destructor for 'H' first required here}}
+// expected-error@-4 {{call to implicitly-deleted default constructor of 'J'}}
+#endif
+
+#else
+void J::foo() {
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor for 'H' first required here}}
+#endif
}
#endif
Index: test/SemaCXX/printf-cstr.cpp
===================================================================
--- test/SemaCXX/printf-cstr.cpp
+++ test/SemaCXX/printf-cstr.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -Wformat -verify %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++98 %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++11 %s -Wno-error=non-pod-varargs
#include <stdarg.h>
@@ -31,12 +33,39 @@
int n = 10;
printf("%d: %s\n", n, hcs.c_str());
- printf("%d: %s\n", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}}
- printf("%d: %s\n", n, hncs); // expected-warning{{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}}
- sprintf(str, "%d: %s", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}}
-
- printf(formatString, hcs, hncs); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}} expected-warning{{cannot pass object of non-POD type 'HasNoCStr' through variadic function}}
- printf(extstr, hcs, n); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}}
+ printf("%d: %s\n", n, hcs);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}}
+ // expected-note@-3 {{did you mean to call the c_str() method?}}
+#else
+ // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}}
+#endif
+
+ printf("%d: %s\n", n, hncs);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}}
+#else
+ // expected-warning@-4 {{format specifies type 'char *' but the argument has type 'HasNoCStr'}}
+#endif
+
+ sprintf(str, "%d: %s", n, hcs);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}}
+ // expected-note@-3 {{did you mean to call the c_str() method?}}
+#else
+ // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}}
+#endif
+
+ printf(formatString, hcs, hncs);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{cannot pass object of non-POD type 'HasCStr' through variadic function}}
+ // expected-warning@-3 {{cannot pass object of non-POD type 'HasNoCStr' through variadic function}}
+#endif
+
+ printf(extstr, hcs, n);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{cannot pass object of non-POD type 'HasCStr' through variadic function}}
+#endif
}
struct Printf {
@@ -49,5 +78,11 @@
const char str[] = "test";
HasCStr hcs(str);
Printf p("%s %d %s", str, 10, 10); // expected-warning {{format specifies type 'char *' but the argument has type 'int'}}
- Printf q("%s %d", hcs, 10); // expected-warning {{cannot pass non-POD object of type 'HasCStr' to variadic constructor; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}}
+ Printf q("%s %d", hcs, 10);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic constructor; expected type from format string was 'char *'}}
+ // expected-note@-3 {{did you mean to call the c_str() method?}}
+#else
+ // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}}
+#endif
}
Index: test/SemaCXX/format-strings.cpp
===================================================================
--- test/SemaCXX/format-strings.cpp
+++ test/SemaCXX/format-strings.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks -std=c++11 %s
#include <stdarg.h>
@@ -9,9 +11,13 @@
}
void f(char **sp, float *fp) {
- scanf("%as", sp); // expected-warning{{'a' length modifier is not supported by ISO C}}
+ scanf("%as", sp);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{'a' length modifier is not supported by ISO C}}
+#else
+ // expected-warning@-4 {{format specifies type 'float *' but the argument has type 'char **'}}
+#endif
- // TODO: Warn that the 'a' conversion specifier is a C++11 feature.
printf("%a", 1.0);
scanf("%afoobar", fp);
}
@@ -46,11 +52,19 @@
// Test handling __null for format string literal checking.
extern "C" {
int test_null_format(const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
+#if __cplusplus >= 201103L
+ // expected-note@-2 {{candidate function not viable: no known conversion from 'bool' to 'const char *' for 1st argument}}
+#endif
}
void rdar8269537(const char *f)
{
- test_null_format(false); // expected-warning {{null from a constant boolean}}
+ test_null_format(false);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{null from a constant boolean}}
+#else
+ // expected-error@-4 {{no matching function for call to 'test_null_format'}}
+#endif
test_null_format(0); // no-warning
test_null_format(__null); // no-warning
test_null_format(f); // expected-warning {{not a string literal}}
Index: test/SemaCXX/default-constructor-initializers.cpp
===================================================================
--- test/SemaCXX/default-constructor-initializers.cpp
+++ test/SemaCXX/default-constructor-initializers.cpp
@@ -1,26 +1,59 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct X1 { // has no implicit default constructor
X1(int);
};
-struct X2 : X1 { // expected-note 2 {{'X2' declared here}}
- X2(int);
-};
-
-struct X3 : public X2 { // expected-error {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}}
-};
-X3 x3; // expected-note {{first required here}}
+struct X2 : X1 {
+#if __cplusplus <= 199711L
+// expected-note@-2 2 {{'X2' declared here}}
+#endif
-
-struct X4 { // expected-error {{must explicitly initialize the member 'x2'}} \
- // expected-error {{must explicitly initialize the reference member 'rx2'}}
- X2 x2; // expected-note {{member is declared here}}
- X2 & rx2; // expected-note {{declared here}}
+ X2(int);
};
-X4 x4; // expected-note {{first required here}}
-
+struct X3 : public X2 {
+#if __cplusplus <= 199711L
+// expected-error@-2 {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}}
+#else
+// expected-note@-4 {{default constructor of 'X3' is implicitly deleted because base class 'X2' has no default constructor}}
+#endif
+};
+
+X3 x3;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{first required here}}
+#else
+// expected-error@-4 {{call to implicitly-deleted default constructor of 'X3'}}
+#endif
+
+struct X4 {
+#if __cplusplus <= 199711L
+// expected-error@-2 {{must explicitly initialize the member 'x2'}}
+// expected-error@-3 {{must explicitly initialize the reference member 'rx2'}}
+#endif
+
+ X2 x2;
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{member is declared here}}
+#else
+ // expected-note@-4 {{default constructor of 'X4' is implicitly deleted because field 'x2' has no default constructor}}
+#endif
+
+ X2 & rx2;
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{declared here}}
+#endif
+};
+
+X4 x4;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{first required here}}
+#else
+// expected-error@-4 {{call to implicitly-deleted default constructor of 'X4'}}
+#endif
struct Y1 { // has no implicit default constructor
Y1(int);
@@ -43,15 +76,33 @@
// More tests
-struct Z1 { // expected-error {{must explicitly initialize the reference member 'z'}} \
- // expected-error {{must explicitly initialize the const member 'c1'}}
- int& z; // expected-note {{declared here}}
- const int c1; // expected-note {{declared here}}
+struct Z1 {
+#if __cplusplus <= 199711L
+// expected-error@-2 {{must explicitly initialize the reference member 'z'}}
+// expected-error@-3 {{must explicitly initialize the const member 'c1'}}
+#endif
+
+ int& z;
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{declared here}}
+#else
+ // expected-note@-4 {{default constructor of 'Z1' is implicitly deleted because field 'z' of reference type 'int &' would not be initialized}}
+#endif
+
+ const int c1;
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{declared here}}
+#endif
volatile int v1;
};
// Test default initialization which *requires* a constructor call for non-POD.
-Z1 z1; // expected-note {{first required here}}
+Z1 z1;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{first required here}}
+#else
+// expected-error@-4 {{call to implicitly-deleted default constructor of 'Z1'}}
+#endif
// Ensure that value initialization doesn't use trivial implicit constructors.
namespace PR7948 {
Index: test/SemaCXX/default-assignment-operator.cpp
===================================================================
--- test/SemaCXX/default-assignment-operator.cpp
+++ test/SemaCXX/default-assignment-operator.cpp
@@ -1,16 +1,34 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
-class Base { // expected-error {{cannot define the implicit copy assignment operator for 'Base', because non-static reference member 'ref' cannot use copy assignment operator}} \
- // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}}
- int &ref; // expected-note {{declared here}} \
- // expected-note{{reference member 'ref' will never be initialized}}
+class Base { // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}}
+#if __cplusplus <= 199711L
+// expected-error@-2 {{cannot define the implicit copy assignment operator for 'Base', because non-static reference member 'ref' cannot use copy assignment operator}}
+#endif
+
+ int &ref; // expected-note{{reference member 'ref' will never be initialized}}
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{declared here}}
+#else
+ // expected-note@-4 2 {{copy assignment operator of 'Base' is implicitly deleted because field 'ref' is of reference type 'int &'}}
+#endif
};
-class X : Base { // // expected-error {{cannot define the implicit copy assignment operator for 'X', because non-static const member 'cint' cannot use copy assignment operator}} \
-// expected-note{{assignment operator for 'Base' first required here}}
+class X : Base {
+#if __cplusplus <= 199711L
+// expected-note@-2 {{assignment operator for 'Base' first required here}}
+// expected-error@-3 {{cannot define the implicit copy assignment operator for 'X', because non-static const member 'cint' cannot use copy assignment operator}}
+#else
+// expected-note@-5 2 {{copy assignment operator of 'X' is implicitly deleted because base class 'Base' has a deleted copy assignment operator}}
+#endif
+
public:
X();
- const int cint; // expected-note {{declared here}}
+ const int cint;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{declared here}}
+#endif
};
struct Y : X {
@@ -28,8 +46,17 @@
// Test1
void f(X x, const X cx) {
- x = cx; // expected-note{{assignment operator for 'X' first required here}}
x = cx;
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{assignment operator for 'X' first required here}}
+#else
+ // expected-error@-4 {{object of type 'X' cannot be assigned because its copy assignment operator is implicitly deleted}}
+#endif
+
+ x = cx;
+#if __cplusplus >= 201103L
+ // expected-error@-2 {{object of type 'X' cannot be assigned because its copy assignment operator is implicitly deleted}}
+#endif
z1 = z2;
}
@@ -73,36 +100,62 @@
// Test5
-class E1 { // expected-error{{cannot define the implicit copy assignment operator for 'E1', because non-static const member 'a' cannot use copy assignment operator}}
+class E1 {
+#if __cplusplus <= 199711L
+// expected-error@-2 {{cannot define the implicit copy assignment operator for 'E1', because non-static const member 'a' cannot use copy assignment operator}}
+#endif
public:
- const int a; // expected-note{{declared here}}
- E1() : a(0) {}
+ const int a;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{declared here}}
+#else
+// expected-note@-4 {{copy assignment operator of 'E1' is implicitly deleted because field 'a' is of const-qualified type 'const int'}}
+#endif
+ E1() : a(0) {}
};
E1 e1, e2;
void j() {
- e1 = e2; // expected-note{{assignment operator for 'E1' first required here}}
+ e1 = e2;
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{assignment operator for 'E1' first required here}}
+#else
+ // expected-error@-4 {{object of type 'E1' cannot be assigned because its copy assignment operator is implicitly deleted}}
+#endif
}
namespace ProtectedCheck {
struct X {
protected:
- X &operator=(const X&); // expected-note{{declared protected here}}
+ X &operator=(const X&);
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{declared protected here}}
+#endif
};
struct Y : public X { };
void f(Y y) { y = y; }
- struct Z { // expected-error{{'operator=' is a protected member of 'ProtectedCheck::X'}}
+ struct Z {
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{'operator=' is a protected member of 'ProtectedCheck::X'}}
+#endif
X x;
+#if __cplusplus >= 201103L
+ // expected-note@-2 {{copy assignment operator of 'Z' is implicitly deleted because field 'x' has an inaccessible copy assignment operator}}
+#endif
};
- void f(Z z) { z = z; } // expected-note{{implicit copy assignment operator}}
-
+ void f(Z z) { z = z; }
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{implicit copy assignment operator}}
+#else
+ // expected-error@-4 {{object of type 'ProtectedCheck::Z' cannot be assigned because its copy assignment operator is implicitly deleted}}
+#endif
}
namespace MultiplePaths {
Index: test/SemaCXX/PR9572.cpp
===================================================================
--- test/SemaCXX/PR9572.cpp
+++ test/SemaCXX/PR9572.cpp
@@ -1,15 +1,49 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
class Base {
- virtual ~Base(); // expected-note {{implicitly declared private here}}
+ virtual ~Base();
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{implicitly declared private here}}
+#else
+ // expected-note@-4 {{overridden virtual function is here}}
+#endif
};
-struct Foo : public Base { // expected-error {{base class 'Base' has private destructor}}
- const int kBlah = 3; // expected-warning {{is a C++11 extension}}
+
+struct Foo : public Base {
+#if __cplusplus <= 199711L
+// expected-error@-2 {{base class 'Base' has private destructor}}
+#else
+// expected-error@-4 {{deleted function '~Foo' cannot override a non-deleted function}}
+// expected-note@-5 {{overridden virtual function is here}}
+// expected-note@-6 3 {{destructor of 'Foo' is implicitly deleted because base class 'Base' has an inaccessible destructor}}
+#endif
+
+ const int kBlah = 3;
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}}
+#endif
+
Foo();
};
+
struct Bar : public Foo {
- Bar() { } // expected-note {{implicit destructor for 'Foo' first required here}}
+#if __cplusplus >= 201103L
+// expected-error@-2 {{non-deleted function '~Bar' cannot override a deleted function}}
+#endif
+ Bar() { }
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{implicit destructor for 'Foo' first required here}}
+#else
+ // expected-error@-4 {{attempt to use a deleted function}}
+#endif
};
+
struct Baz {
Foo f;
Baz() { }
+#if __cplusplus >= 201103L
+ // expected-error@-2 {{attempt to use a deleted function}}
+#endif
};
Index: test/SemaCXX/MicrosoftExtensions.cpp
===================================================================
--- test/SemaCXX/MicrosoftExtensions.cpp
+++ test/SemaCXX/MicrosoftExtensions.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
+// RUN: %clang_cc1 -std=c++98 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
+// RUN: %clang_cc1 -std=c++11 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fexceptions -fcxx-exceptions -DTEST2
#if TEST1
@@ -23,11 +25,17 @@
};
class A {
- virtual ~A() throw(); // expected-note {{overridden virtual function is here}}
+ virtual ~A() throw();
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{overridden virtual function is here}}
+#endif
};
class B : public A {
- virtual ~B(); // expected-warning {{exception specification of overriding function is more lax than base version}}
+ virtual ~B();
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{exception specification of overriding function is more lax than base version}}
+#endif
};
}
@@ -174,11 +182,18 @@
typedef int Int;
struct X0 {
- enum E1 : Int { SomeOtherValue } field; // expected-warning{{enumeration types with a fixed underlying type are a C++11 extension}}
+ enum E1 : Int { SomeOtherValue } field;
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{enumeration types with a fixed underlying type are a C++11 extension}}
+#endif
+
enum E1 : seventeen;
};
-enum : long long { // expected-warning{{enumeration types with a fixed underlying type are a C++11 extension}}
+#if __cplusplus <= 199711L
+// expected-warning@+2 {{enumeration types with a fixed underlying type are a C++11 extension}}
+#endif
+enum : long long {
SomeValue = 0x100000000
};
@@ -450,7 +465,9 @@
// FIXME. warning can be suppressed if we're also issuing error for overriding a 'final' function.
virtual void SealedFunction(); // expected-warning {{'SealedFunction' overrides a member function but is not marked 'override'}}
- // expected-warning@+1 {{'override' keyword is a C++11 extension}}
+#if __cplusplus <= 199711L
+ // expected-warning@+2 {{'override' keyword is a C++11 extension}}
+#endif
virtual void OverrideMe() override;
};
Index: test/OpenMP/openmp_check.cpp
===================================================================
--- test/OpenMP/openmp_check.cpp
+++ test/OpenMP/openmp_check.cpp
@@ -1,15 +1,35 @@
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
+
int nested(int a) {
#pragma omp parallel
++a;
- auto F = [&]() { // expected-error {{expected expression}} expected-error {{expected ';' at end of declaration}} expected-warning {{'auto' type specifier is a C++11 extension}}
+ auto F = [&]() {
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{'auto' type specifier is a C++11 extension}}
+ // expected-error@-3 {{expected expression}}
+ // expected-error@-4 {{expected ';' at end of declaration}}
+#else
+ // expected-no-diagnostics
+#endif
+
#pragma omp parallel
{
#pragma omp target
++a;
}
};
- F(); // expected-error {{C++ requires a type specifier for all declarations}}
- return a; // expected-error {{expected unqualified-id}}
-}// expected-error {{extraneous closing brace ('}')}}
+ F();
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{C++ requires a type specifier for all declarations}}
+#endif
+ return a;
+#if __cplusplus <= 199711L
+ // expected-error@-2 {{expected unqualified-id}}
+#endif
+}
+#if __cplusplus <= 199711L
+// expected-error@-2 {{extraneous closing brace ('}')}}
+#endif
Index: test/OpenMP/declare_reduction_messages.cpp
===================================================================
--- test/OpenMP/declare_reduction_messages.cpp
+++ test/OpenMP/declare_reduction_messages.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
int temp; // expected-note 7 {{'temp' declared here}}
@@ -51,7 +53,17 @@
#pragma omp declare reduction(fun222 : long : omp_out += omp_in) // expected-error {{redefinition of user-defined reduction for type 'long'}}
#pragma omp declare reduction(fun1 : long : omp_out += omp_in) initializer // expected-error {{expected '(' after 'initializer'}}
#pragma omp declare reduction(fun2 : long : omp_out += omp_in) initializer { // expected-error {{expected '(' after 'initializer'}} expected-error {{expected expression}} expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
-#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[ // expected-error {{expected '(' after 'initializer'}} expected-error {{expected expression}} expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
+#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[
+#if __cplusplus <= 199711L
+// expected-error@-2 {{expected '(' after 'initializer'}}
+// expected-error@-3 {{expected expression}}
+// expected-warning@-4 {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
+#else
+// expected-error@-6 {{expected '(' after 'initializer'}}
+// expected-error@-7 {{expected variable name or 'this' in lambda capture list}}
+// expected-error@-8 {{expected ')'}}
+// expected-note@-9 {{to match this '('}}
+#endif
#pragma omp declare reduction(fun4 : long : omp_out += omp_in) initializer() // expected-error {{expected expression}}
#pragma omp declare reduction(fun5 : long : omp_out += omp_in) initializer(temp) // expected-error {{only 'omp_priv' or 'omp_orig' variables are allowed in initializer expression}}
#pragma omp declare reduction(fun6 : long : omp_out += omp_in) initializer(omp_orig // expected-error {{expected ')'}} expected-note {{to match this '('}}
Index: test/Modules/merge-using-decls.cpp
===================================================================
--- test/Modules/merge-using-decls.cpp
+++ test/Modules/merge-using-decls.cpp
@@ -1,6 +1,10 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=1
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=1
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=1
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=2
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=2
#if ORDER == 1
#include "a.h"
@@ -24,7 +28,11 @@
}
template<typename T> int UseAll() {
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
return Use<C<T> >() + Use<D<T> >() + Use<E<T> >() + Use<F<T> >(); // expected-note 0-2{{instantiation of}}
+#else
+ return Use<C<T> >() + Use<D<T> >() + Use<F<T> >(); // expected-note 0-2{{instantiation of}}
+#endif
}
template int UseAll<YA>();
@@ -37,8 +45,10 @@
// Here, we're instantiating the definition from 'A' and merging the definition
// from 'B' into it.
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
// [email protected]:* {{'E::value' from module 'B' is not present in definition of 'E<T>' in module 'A'}}
// [email protected]:* {{'E::v' from module 'B' is not present in definition of 'E<T>' in module 'A'}}
+#endif
// [email protected]:* {{'F::type' from module 'B' is not present in definition of 'F<T>' in module 'A'}}
// [email protected]:* {{'F::t' from module 'B' is not present in definition of 'F<T>' in module 'A'}}
@@ -55,11 +65,14 @@
// [email protected]:* 2{{'typename' keyword used on a non-type}}
// [email protected]:* 2{{dependent using declaration resolved to type without 'typename'}}
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
// [email protected]:* {{'E::type' from module 'A' is not present in definition of 'E<T>' in module 'B'}}
// [email protected]:* {{'E::t' from module 'A' is not present in definition of 'E<T>' in module 'B'}}
// [email protected]:* {{'E::value' from module 'A' is not present in definition of 'E<T>' in module 'B'}}
// [email protected]:* {{'E::v' from module 'A' is not present in definition of 'E<T>' in module 'B'}}
// [email protected]:* 2{{definition has no member}}
+#endif
+
// [email protected]:* {{'F::type' from module 'A' is not present in definition of 'F<T>' in module 'B'}}
// [email protected]:* {{'F::t' from module 'A' is not present in definition of 'F<T>' in module 'B'}}
Index: test/Modules/Inputs/merge-using-decls/b.h
===================================================================
--- test/Modules/Inputs/merge-using-decls/b.h
+++ test/Modules/Inputs/merge-using-decls/b.h
@@ -29,11 +29,13 @@
using typename X::t;
};
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
template<typename T> struct E : X, T {
// Mismatch in using/access-declaration-ness.
T::value;
X::v;
};
+#endif
template<typename T> struct F : X, T {
// Mismatch in nested-name-specifier.
@@ -46,5 +48,9 @@
// Force instantiation.
typedef C<YB>::type I;
typedef D<YBRev>::t I;
+
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
typedef E<YB>::type I;
+#endif
+
typedef F<YB>::type I;
Index: test/Modules/Inputs/merge-using-decls/a.h
===================================================================
--- test/Modules/Inputs/merge-using-decls/a.h
+++ test/Modules/Inputs/merge-using-decls/a.h
@@ -22,12 +22,14 @@
using typename X::t;
};
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
template<typename T> struct E : X, T {
using T::value;
using typename T::type;
using X::v;
using typename X::t;
};
+#endif
template<typename T> struct F : X, T {
using T::value;
@@ -39,5 +41,9 @@
// Force instantiation.
typedef C<YA>::type I;
typedef D<YA>::type I;
+
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
typedef E<YA>::type I;
+#endif
+
typedef F<YA>::type I;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits