summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/dllexport.cpp
diff options
context:
space:
mode:
authorNico Rieck <nico.rieck@gmail.com>2014-05-23 19:07:49 +0000
committerNico Rieck <nico.rieck@gmail.com>2014-05-23 19:07:49 +0000
commitffd8a3364c700f560b5d37e32364b5e53041f1cb (patch)
tree4ff3c254499015fa606fce8c0862a2fa52e836e5 /clang/test/SemaCXX/dllexport.cpp
parent4da7debf7d0f638fa4df6e81db33976dc3d442dc (diff)
downloadbcm5719-llvm-ffd8a3364c700f560b5d37e32364b5e53041f1cb.tar.gz
bcm5719-llvm-ffd8a3364c700f560b5d37e32364b5e53041f1cb.zip
Sema: Add more tests for dll attributes on inline functions
llvm-svn: 209542
Diffstat (limited to 'clang/test/SemaCXX/dllexport.cpp')
-rw-r--r--clang/test/SemaCXX/dllexport.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/dllexport.cpp b/clang/test/SemaCXX/dllexport.cpp
index 6d67ec25da3..4d3538e3299 100644
--- a/clang/test/SemaCXX/dllexport.cpp
+++ b/clang/test/SemaCXX/dllexport.cpp
@@ -111,15 +111,20 @@ __declspec(dllexport) void redecl2();
void redecl3(); // expected-note{{previous declaration is here}}
__declspec(dllexport) void redecl3(); // expected-error{{redeclaration of 'redecl3' cannot add 'dllexport' attribute}}
+ void redecl4(); // expected-note{{previous declaration is here}}
+__declspec(dllexport) inline void redecl4() {} // expected-error{{redeclaration of 'redecl4' cannot add 'dllexport' attribute}}
+
// Friend functions
struct FuncFriend {
friend __declspec(dllexport) void friend1();
friend __declspec(dllexport) void friend2();
friend void friend3(); // expected-note{{previous declaration is here}}
+ friend void friend4(); // expected-note{{previous declaration is here}}
};
__declspec(dllexport) void friend1() {}
void friend2() {}
__declspec(dllexport) void friend3() {} // expected-error{{redeclaration of 'friend3' cannot add 'dllexport' attribute}}
+__declspec(dllexport) inline void friend4() {} // expected-error{{redeclaration of 'friend4' cannot add 'dllexport' attribute}}
// Implicit declarations can be redeclared with dllexport.
__declspec(dllexport) void* operator new(__SIZE_TYPE__ n);
@@ -143,6 +148,16 @@ template<typename T> void __declspec(dllexport) funcTmplDecl2();
// Export function template definition.
template<typename T> __declspec(dllexport) void funcTmplDef() {}
+// Export inline function template.
+template<typename T> __declspec(dllexport) inline void inlineFuncTmpl1() {}
+template<typename T> inline void __attribute__((dllexport)) inlineFuncTmpl2() {}
+
+template<typename T> __declspec(dllexport) inline void inlineFuncTmplDecl();
+template<typename T> void inlineFuncTmplDecl() {}
+
+template<typename T> __declspec(dllexport) void inlineFuncTmplDef();
+template<typename T> inline void inlineFuncTmplDef() {}
+
// Redeclarations
template<typename T> __declspec(dllexport) void funcTmplRedecl1();
template<typename T> __declspec(dllexport) void funcTmplRedecl1() {}
@@ -153,15 +168,20 @@ template<typename T> void funcTmplRedecl2() {}
template<typename T> void funcTmplRedecl3(); // expected-note{{previous declaration is here}}
template<typename T> __declspec(dllexport) void funcTmplRedecl3(); // expected-error{{redeclaration of 'funcTmplRedecl3' cannot add 'dllexport' attribute}}
+template<typename T> void funcTmplRedecl4(); // expected-note{{previous declaration is here}}
+template<typename T> __declspec(dllexport) inline void funcTmplRedecl4() {} // expected-error{{redeclaration of 'funcTmplRedecl4' cannot add 'dllexport' attribute}}
+
// Function template friends
struct FuncTmplFriend {
template<typename T> friend __declspec(dllexport) void funcTmplFriend1();
template<typename T> friend __declspec(dllexport) void funcTmplFriend2();
template<typename T> friend void funcTmplFriend3(); // expected-note{{previous declaration is here}}
+ template<typename T> friend void funcTmplFriend4(); // expected-note{{previous declaration is here}}
};
template<typename T> __declspec(dllexport) void funcTmplFriend1() {}
template<typename T> void funcTmplFriend2() {}
template<typename T> __declspec(dllexport) void funcTmplFriend3() {} // expected-error{{redeclaration of 'funcTmplFriend3' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport) inline void funcTmplFriend4() {} // expected-error{{redeclaration of 'funcTmplFriend4' cannot add 'dllexport' attribute}}
// External linkage is required.
template<typename T> __declspec(dllexport) static int staticFuncTmpl(); // expected-error{{'staticFuncTmpl' must have external linkage when declared 'dllexport'}}
OpenPOWER on IntegriCloud