tigerleapgorge created this revision.

I am continuing to make Lit tests C++11 compatible.
This patch contains 4 tests, previously in review 
https://reviews.llvm.org/D20710 and https://reviews.llvm.org/D21626.

test/SemaCXX/MicrosoftExtensions.cpp

  This test checks for Microsoft extensions.
  Portions of this test check for unsupported C++11 features when compiling at 
C++98.
  Guard all such diagnostics under C++98.
  
  Base destructor being marked with “throw()”, derived destructor is not.
  This no longer results in the following diagnostics in C++11.
    C++98: warning: exception specification of overriding function is more lax 
than base version [-Wmicrosoft-exception-spec]
           note: overridden virtual function is here
  
  Enum with underlying type is now supported in C++11. Guard the following 
under C++98.
    C++98: warning: enumeration types with a fixed underlying type are a C++11 
extension [-Wc++11-extensions]
    C++98: warning: enumeration types with a fixed underlying type are a C++11 
extension [-Wc++11-extensions]
  
  “override” is now supported in C++11. Guard the following under C++98.
    C++98: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]

test/SemaCXX/implicit-virtual-member-functions.cpp

  Change in diagnostics (3 instances)
    C++98: error: no suitable member 'operator delete' in 'B'
           note: member 'operator delete' declared here
           note: implicit destructor for 'B' first required here
    C++11: error: deleted function '~B' cannot override a non-deleted function
           note: overridden virtual function is here
  
  Added diagnostics in C++11 when target is Microsoft.
    C++11: error: attempt to use a deleted function
           note: virtual destructor requires an unambiguous, accessible 
                 'operator delete'

test/SemaCXX/virtual-base-used.cpp

  The base class explicitly declares a public virtual destructor.
  The derived class does not explicitly declare a destructor.
  The derived class contains a member with an inaccessible private destructor.
  In C++98, Clang Warns about the private destructor then gives a Note at class 
instantiation (MSABI) or class method definition.
  In C++11, The derived class having a member that can not be destroyed means 
the derived class’s own implicit destructor is deleted.
            Therefore, Clang issues an Error on the derived class’s deleted 
destructor trying to overwrite base class’s non-deleted destructor.
            Furthermore, Clang also issues Errors on classes further down the 
inheritance chain with explicitly declared destructors trying to 
            overwrite first derived class’s implicitly deleted destructor.
  
  This test is subdivided into three sections. Each section has its own 
inheritance chain.
  
  Section 1:
   A is the base struct with a virtual destructor.
   B derives from A. B has a member class instance ‘x’ with an inaccessible 
destructor.
   D derives from B. D has an explicitly declared destructor.
   In C++98, Clang issues an Error about B’s x having no accessible destructor.
    In C++11, Clang issues 2 Errors.
              First Error on B’s implicitly deleted destructor inheriting A’s 
explicitly declared destructor.
              Second Error on D’s explicitly declared destructor inheriting B’s 
implicitly deleted destructor.
  
    C++98: error: field of type 'NoDestroy' has private destructor
           note: implicitly declared private here
           note: implicit destructor for 'B' first required here
    C++11: error: deleted function '~B' cannot override a non-deleted function
           note: overridden virtual function is here
           error: non-deleted function '~D' cannot override a deleted function
           note: overridden virtual function is here
  
  Section 2:
    A is the base struct with a virtual destructor.
    E derives A. E also has a member class instance x with no destructor.
    F derives from E and has no explicitly declared destructor.
    G derives from F and has an explicitly declared destructor.
    In C++98, Clang issues an Error about E’s x having no accessible destructor.
    In C++11, Clang issues 3 Errors.
              First Error about E’s implicitly deleted destructor inheriting 
A’s explicitly declared destructor.
              Second Error about F’s implicitly declared destructor inheriting 
E’s implicitly deleted destructor.
              Third Error about G’s explicitly declared destructor inheriting 
F’s now implicitly deleted destructor.
  
    C++98: error: field of type 'NoDestroy' has private destructor
           note: implicitly declared private here
           note: implicit destructor for 'E' first required here
    C++11: error: deleted function '~E' cannot override a non-deleted function
           note: overridden virtual function is here
           error: non-deleted function '~F' cannot override a deleted function
           note: overridden virtual function is here
           error: non-deleted function '~G' cannot override a deleted function
           note: overridden virtual function is here
  
  
  Section 3:
    A is a struct with a virtual destructor.
    H derives from A. H has a member x with an inaccessible destructor.
    I derives from H.
    J derives from I. J has a member function foo() definition.
    In C++98, Clang issues an error on the H’s member X having an private 
destructor.
    In C++11, Clang issues 2 errors. 
              First  Error on H’s implicitly deleted destructor inheriting A’s 
explicitly declared destructor.
              Second Error on I’s explicitly declared destructor inheriting H’s 
implicitly deleted destructor.
  
    C++98: error: field of type 'NoDestroy' has private destructor
           note: implicitly declared private here
           note: implicit destructor for 'H' first required here
    C++11: error: deleted function '~H' cannot override a non-deleted function
           note: overridden virtual function is here
           error: non-deleted function '~I' cannot override a deleted function
           note: overridden virtual function is here

test/SemaTemplate/virtual-member-functions.cpp

  Change in diagnostics when derived class inherits a private destructor
  in the base class.
  
  C++98: error: base class 'PR7114::A' has private destructor
         note: implicitly declared private here
         note: implicit destructor for 'PR7114::B<float>::Inner' first required 
here
  
  C++11: error: deleted function '~Inner' cannot override a non-deleted function
         note: in instantiation of member class 'PR7114::B<int>::Inner' 
requested here
         note: in instantiation of template class 'PR7114::B<int>' requested 
here
         note: overridden virtual function is here
  
         error: deleted function '~Inner' cannot override a non-deleted function
         note: in instantiation of member class 'PR7114::B<float>::Inner' 
requested here
         note: in instantiation of template class 'PR7114::B<float>' requested 
here
         note: overridden virtual function is here
  
         error: deleted function '~X' cannot override a non-deleted function
         note: in instantiation of template class 'PR7114::X<int>' requested 
here
         note: overridden virtual function is here


https://reviews.llvm.org/D29520

Files:
  test/SemaCXX/MicrosoftExtensions.cpp
  test/SemaCXX/implicit-virtual-member-functions.cpp
  test/SemaCXX/virtual-base-used.cpp
  test/SemaTemplate/virtual-member-functions.cpp

Index: test/SemaTemplate/virtual-member-functions.cpp
===================================================================
--- test/SemaTemplate/virtual-member-functions.cpp
+++ test/SemaTemplate/virtual-member-functions.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -std=c++11 %s
 // RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++98 -verify %s
+// RUN: %clang_cc1 -triple %ms_abi_triple -DMSABI -fsyntax-only -std=c++11 -verify %s
 
 namespace PR5557 {
 template <class T> struct A {
@@ -76,34 +80,76 @@
 }
 
 namespace PR7114 {
-  class A { virtual ~A(); }; // expected-note{{declared private here}}
+  class A { virtual ~A(); };
+#if __cplusplus <= 199711L
+  // expected-note@-2{{declared private here}}
+#else
+  // expected-note@-4 3 {{overridden virtual function is here}}
+#endif
 
   template<typename T>
   class B {
   public:
-    class Inner : public A { }; // expected-error{{base class 'PR7114::A' has private destructor}}
+    class Inner : public A { };
+#if __cplusplus <= 199711L
+// expected-error@-2{{base class 'PR7114::A' has private destructor}}
+#else
+// expected-error@-4 2 {{deleted function '~Inner' cannot override a non-deleted function}}
+// expected-note@-5 2 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}}
+#ifdef MSABI
+// expected-note@-7 1 {{destructor of 'Inner' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}}
+#endif
+#endif
+
     static Inner i;
     static const unsigned value = sizeof(i) == 4;
+#if __cplusplus >= 201103L
+// expected-note@-2 {{in instantiation of member class 'PR7114::B<int>::Inner' requested here}}
+// expected-note@-3 {{in instantiation of member class 'PR7114::B<float>::Inner' requested here}}
+#endif
   };
 
   int f() { return B<int>::value; }
+#if __cplusplus >= 201103L
+// expected-note@-2 {{in instantiation of template class 'PR7114::B<int>' requested here}}
+#endif
 
 #ifdef MSABI
-  void test_typeid(B<float>::Inner bfi) { // expected-note{{implicit destructor}}
+  void test_typeid(B<float>::Inner bfi) {
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor}}
+#else
+// expected-error@-4 {{attempt to use a deleted function}}
+// expected-note@-5 {{in instantiation of template class 'PR7114::B<float>' requested here}}
+#endif
+
     (void)typeid(bfi);
 #else
   void test_typeid(B<float>::Inner bfi) {
-    (void)typeid(bfi); // expected-note{{implicit destructor}}
+#if __cplusplus >= 201103L
+// expected-note@-2 {{in instantiation of template class 'PR7114::B<float>' requested here}}
+#endif
+    (void)typeid(bfi);
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor}}
+#endif
 #endif
   }
 
   template<typename T>
   struct X : A {
+#if __cplusplus >= 201103L
+// expected-error@-2 {{deleted function '~X' cannot override a non-deleted function}}
+// expected-note@-3  {{destructor of 'X<int>' is implicitly deleted because base class 'PR7114::A' has an inaccessible destructor}}
+#endif
     void f() { }
   };
 
   void test_X(X<int> &xi, X<float> &xf) {
     xi.f();
+#if __cplusplus >= 201103L
+// expected-note@-2 {{in instantiation of template class 'PR7114::X<int>' requested here}}
+#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/implicit-virtual-member-functions.cpp
===================================================================
--- test/SemaCXX/implicit-virtual-member-functions.cpp
+++ test/SemaCXX/implicit-virtual-member-functions.cpp
@@ -1,33 +1,87 @@
 // 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
+
 struct A {
   virtual ~A();
+#if __cplusplus >= 201103L
+// expected-note@-2 3 {{overridden virtual function is here}}
+#endif
 };
 
-struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}}
+struct B : A {
+#if __cplusplus <= 199711L
+// expected-error@-2 {{no suitable member 'operator delete' in 'B'}}
+#else
+// expected-error@-4 {{deleted function '~B' cannot override a non-deleted function}}
+// expected-note@-5  {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
+#ifdef MSABI
+// expected-note@-7 {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
+#endif
+#endif
   virtual void f();
 
-  void operator delete (void *, int); // expected-note {{'operator delete' declared here}}
+  void operator delete (void *, int);
+#if __cplusplus <= 199711L
+// expected-note@-2 {{'operator delete' declared here}}
+#endif
 };
 
 #ifdef MSABI
-B b; // expected-note {{implicit destructor for 'B' first required here}}
+B b;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor for 'B' first required here}}
+#else
+// expected-error@-4 {{attempt to use a deleted function}}
+#endif
+
 #else
-void B::f() { // expected-note {{implicit destructor for 'B' first required here}}
+void B::f() {
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor for 'B' first required here}}
+#endif
 }
 #endif
 
-struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}}
+struct C : A {
+#if __cplusplus <= 199711L
+// expected-error@-2 {{no suitable member 'operator delete' in 'C'}}
+#else
+// expected-error@-4 {{deleted function '~C' cannot override a non-deleted function}}
+// expected-note@-5  {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
+#endif
+
   C();
-  void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
+  void operator delete(void *, int);
+#if __cplusplus <= 199711L
+// expected-note@-2 {{'operator delete' declared here}}
+#endif
 };
 
-C::C() { }  // expected-note {{implicit destructor for 'C' first required here}}
+C::C() { }
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor for 'C' first required here}}
+#endif
 
-struct D : A { // expected-error {{no suitable member 'operator delete' in 'D'}}
-  void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
+struct D : A {
+#if __cplusplus <= 199711L
+// expected-error@-2 {{no suitable member 'operator delete' in 'D'}}
+#else
+// expected-error@-4 {{deleted function '~D' cannot override a non-deleted function}}
+// expected-note@-5  {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
+#endif
+  void operator delete(void *, int);
+#if __cplusplus <= 199711L
+// expected-note@-2 {{'operator delete' declared here}}
+#endif
 }; 
 
 void f() {
-  new D; // expected-note {{implicit destructor for 'D' first required here}}
+  new D;
+#if __cplusplus <= 199711L
+// expected-note@-2 {{implicit destructor for 'D' first required here}}
+#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;
 };
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to