From 9de0a57687b9dec5fd5b579175a526909a47afec Mon Sep 17 00:00:00 2001 From: Nico Rieck Date: Thu, 29 May 2014 16:51:19 +0000 Subject: Sema: Functions with dll attributes cannot be deleted llvm-svn: 209827 --- clang/test/SemaCXX/dllimport.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'clang/test/SemaCXX/dllimport.cpp') diff --git a/clang/test/SemaCXX/dllimport.cpp b/clang/test/SemaCXX/dllimport.cpp index dea83338d17..1f53f7ab592 100644 --- a/clang/test/SemaCXX/dllimport.cpp +++ b/clang/test/SemaCXX/dllimport.cpp @@ -252,6 +252,13 @@ __declspec(dllimport) Internal internalRetFunc(); // expected-error{{'internalRe namespace { __declspec(dllimport) void internalFunc(); } // expected-error{{'(anonymous namespace)::internalFunc' must have external linkage when declared 'dllimport'}} namespace ns { __declspec(dllimport) void externalFunc(); } +// Import deleted functions. +// FIXME: Deleted functions are definitions so a missing inline is diagnosed +// here which is irrelevant. But because the delete keyword is parsed later +// there is currently no straight-forward way to avoid this diagnostic. +__declspec(dllimport) void deletedFunc() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} expected-error{{dllimport cannot be applied to non-inline function definition}} +__declspec(dllimport) inline void deletedInlineFunc() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} + //===----------------------------------------------------------------------===// @@ -459,6 +466,18 @@ struct ImportSpecials { }; +// Import deleted member functions. +struct ImportDeleted { + __declspec(dllimport) ImportDeleted() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} + __declspec(dllimport) ~ImportDeleted() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} + __declspec(dllimport) ImportDeleted(const ImportDeleted&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} + __declspec(dllimport) ImportDeleted& operator=(const ImportDeleted&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} + __declspec(dllimport) ImportDeleted(ImportDeleted&&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} + __declspec(dllimport) ImportDeleted& operator=(ImportDeleted&&) = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} + __declspec(dllimport) void deleted() = delete; // expected-error{{attribute 'dllimport' cannot be applied to a deleted function}} +}; + + // Import allocation functions. struct ImportAlloc { __declspec(dllimport) void* operator new(__SIZE_TYPE__); -- cgit v1.2.3