mirror of https://github.com/microsoft/clang.git
[Lit Test] Make tests C++11 compatible - Microsoft diagnostics
Differential Revision: https://reviews.llvm.org/D29520 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294225 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4966278d0c
commit
b51cd02fb2
|
@ -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 %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
|
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fexceptions -fcxx-exceptions -DTEST2
|
||||||
|
|
||||||
#if TEST1
|
#if TEST1
|
||||||
|
@ -23,11 +25,17 @@ struct Derived : Base {
|
||||||
};
|
};
|
||||||
|
|
||||||
class A {
|
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 {
|
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 @@ const int seventeen = 17;
|
||||||
typedef int Int;
|
typedef int Int;
|
||||||
|
|
||||||
struct X0 {
|
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 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
|
SomeValue = 0x100000000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -450,7 +465,9 @@ struct SealedType sealed : SomeBase {
|
||||||
// FIXME. warning can be suppressed if we're also issuing error for overriding a 'final' function.
|
// 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'}}
|
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;
|
virtual void OverrideMe() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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 %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 %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 {
|
struct A {
|
||||||
virtual ~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();
|
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
|
#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
|
#else
|
||||||
void B::f() { // expected-note {{implicit destructor for 'B' first required here}}
|
// expected-error@-4 {{attempt to use a deleted function}}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
void B::f() {
|
||||||
|
#if __cplusplus <= 199711L
|
||||||
|
// expected-note@-2 {{implicit destructor for 'B' first required here}}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#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();
|
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'}}
|
struct D : A {
|
||||||
void operator delete(void *, int); // expected-note {{'operator delete' declared here}}
|
#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() {
|
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 %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 %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
|
// PR7800
|
||||||
|
|
||||||
// The Microsoft ABI doesn't have the concept of key functions, so we have different
|
// 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.
|
// 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
|
#ifdef MSABI
|
||||||
// expected-note@+2 3 {{declared private here}}
|
// expected-note@-4 3 {{declared private here}}
|
||||||
#endif
|
#endif
|
||||||
class NoDestroy { ~NoDestroy(); }; // expected-note 3 {{declared private here}}
|
#endif
|
||||||
|
|
||||||
struct A {
|
struct A {
|
||||||
virtual ~A();
|
virtual ~A();
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
// expected-note@-2 3 {{overridden virtual function is here}}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MSABI
|
|
||||||
// expected-error@+3 {{field of type 'NoDestroy' has private destructor}}
|
|
||||||
#endif
|
|
||||||
struct B : public virtual A {
|
struct B : public virtual A {
|
||||||
NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
|
#if __cplusplus >= 201103L
|
||||||
};
|
// expected-error@-2 {{deleted function '~B' cannot override a non-deleted function}}
|
||||||
#ifdef MSABI
|
// expected-note@-3 {{overridden virtual function is here}}
|
||||||
// expected-note@+3 {{implicit default constructor for 'B' first required here}}
|
|
||||||
// expected-note@+2 {{implicit destructor for 'B' first required here}}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NoDestroy x;
|
||||||
|
#if __cplusplus <= 199711L
|
||||||
|
// expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
|
||||||
|
#ifdef MSABI
|
||||||
|
// expected-error@-4 {{field of type 'NoDestroy' has private destructor}}
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
// expected-note@-7 {{destructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}}
|
||||||
|
#ifdef MSABI
|
||||||
|
// expected-note@-9 {{default constructor of 'B' is implicitly deleted because field 'x' has an inaccessible destructor}}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
struct D : public virtual B {
|
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();
|
virtual void foo();
|
||||||
~D();
|
~D();
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
//expected-error@-2 {{non-deleted function '~D' cannot override a deleted function}}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MSABI
|
#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
|
#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
|
#endif
|
||||||
|
|
||||||
#ifdef MSABI
|
|
||||||
// expected-error@+3 {{field of type 'NoDestroy' has private destructor}}
|
|
||||||
#endif
|
|
||||||
struct E : public virtual A {
|
struct E : public virtual A {
|
||||||
NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
|
#if __cplusplus >= 201103L
|
||||||
};
|
// expected-error@-2 {{deleted function '~E' cannot override a non-deleted function}}
|
||||||
#ifdef MSABI
|
// expected-note@-3 {{overridden virtual function is here}}
|
||||||
// expected-note@+2 {{implicit default constructor for 'E' first required here}}
|
|
||||||
#endif
|
#endif
|
||||||
struct F : public E { // expected-note {{implicit destructor for 'E' first required here}}
|
|
||||||
};
|
NoDestroy x;
|
||||||
|
#if __cplusplus <= 199711L
|
||||||
|
// expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
|
||||||
#ifdef MSABI
|
#ifdef MSABI
|
||||||
// expected-note@+2 {{implicit default constructor for 'F' first required here}}
|
// expected-error@-4 {{field of type 'NoDestroy' has private destructor}}
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
// expected-note@-7 {{destructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor}}
|
||||||
|
#ifdef MSABI
|
||||||
|
// expected-note@-9 {{default constructor of 'E' is implicitly deleted because field 'x' has an inaccessible destructor}}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
struct F : public E {
|
||||||
|
#if __cplusplus <= 199711L
|
||||||
|
// expected-note@-2 {{implicit destructor for 'E' first required here}}
|
||||||
|
#ifdef MSABI
|
||||||
|
// 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 {
|
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();
|
virtual void foo();
|
||||||
~G();
|
~G();
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
//expected-error@-2 {{non-deleted function '~G' cannot override a deleted function}}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MSABI
|
#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
|
#else
|
||||||
void G::foo() { // expected-note {{implicit destructor for 'F' first required here}}
|
// expected-error@-4 {{call to implicitly-deleted default constructor of 'G'}}
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
void G::foo() {
|
||||||
|
#if __cplusplus <= 199711L
|
||||||
|
// expected-note@-2 {{implicit destructor for 'F' first required here}}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MSABI
|
|
||||||
// expected-note@+3 {{'H' declared here}}
|
|
||||||
// expected-error@+3 {{field of type 'NoDestroy' has private destructor}}
|
|
||||||
#endif
|
|
||||||
struct H : public virtual A {
|
struct H : public virtual A {
|
||||||
NoDestroy x; // expected-error {{field of type 'NoDestroy' has private destructor}}
|
#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
|
#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@-6 {{'H' declared here}}
|
||||||
// expected-note@+2 {{implicit destructor for 'H' first required here}}
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NoDestroy x;
|
||||||
|
#if __cplusplus <= 199711L
|
||||||
|
// expected-error@-2 {{field of type 'NoDestroy' has private destructor}}
|
||||||
|
#ifdef MSABI
|
||||||
|
// 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 {
|
struct I : public virtual H {
|
||||||
~I();
|
|
||||||
};
|
|
||||||
#ifdef MSABI
|
#ifdef MSABI
|
||||||
// expected-note@+3 {{implicit default constructor for 'H' first required here}}
|
#if __cplusplus <= 199711L
|
||||||
// expected-note@+2 {{implicit default constructor for 'I' first required here}}
|
// 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
|
||||||
|
#endif
|
||||||
|
|
||||||
|
~I();
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
// expected-error@-2 {{non-deleted function '~I' cannot override a deleted function}}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
struct J : public I {
|
struct J : public I {
|
||||||
|
#ifdef MSABI
|
||||||
|
#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
|
||||||
|
#endif
|
||||||
|
|
||||||
virtual void foo();
|
virtual void foo();
|
||||||
~J();
|
~J();
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MSABI
|
#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
|
#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
|
#endif
|
||||||
|
|
|
@ -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 %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 -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 {
|
namespace PR5557 {
|
||||||
template <class T> struct A {
|
template <class T> struct A {
|
||||||
|
@ -76,34 +80,76 @@ namespace std {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PR7114 {
|
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>
|
template<typename T>
|
||||||
class B {
|
class B {
|
||||||
public:
|
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 Inner i;
|
||||||
static const unsigned value = sizeof(i) == 4;
|
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; }
|
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
|
#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);
|
(void)typeid(bfi);
|
||||||
#else
|
#else
|
||||||
void test_typeid(B<float>::Inner bfi) {
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct X : A {
|
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 f() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
void test_X(X<int> &xi, X<float> &xf) {
|
void test_X(X<int> &xi, X<float> &xf) {
|
||||||
xi.f();
|
xi.f();
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
// expected-note@-2 {{in instantiation of template class 'PR7114::X<int>' requested here}}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue