summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/dllexport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/dllexport.cpp')
-rw-r--r--clang/test/SemaCXX/dllexport.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/clang/test/SemaCXX/dllexport.cpp b/clang/test/SemaCXX/dllexport.cpp
index e4a312adaee..953684c73a5 100644
--- a/clang/test/SemaCXX/dllexport.cpp
+++ b/clang/test/SemaCXX/dllexport.cpp
@@ -742,7 +742,7 @@ struct MemberRedecl {
static int StaticField; // expected-note{{previous declaration is here}}
static const int StaticConstField; // expected-note{{previous declaration is here}}
- constexpr static int ConstexprField = 1; // expected-note{{previous declaration is here}}
+ constexpr static int ConstexprField = 1; // expected-note-re{{previous {{(declaration|definition)}} is here}}
};
__declspec(dllexport) void MemberRedecl::normalDef() {} // expected-error{{redeclaration of 'MemberRedecl::normalDef' cannot add 'dllexport' attribute}}
@@ -757,7 +757,12 @@ __declspec(dllexport) void MemberRedecl::staticInlineDecl() {} // expect
__declspec(dllexport) int MemberRedecl::StaticField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticField' cannot add 'dllexport' attribute}}
__declspec(dllexport) const int MemberRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemberRedecl::StaticConstField' cannot add 'dllexport' attribute}}
-__declspec(dllexport) constexpr int MemberRedecl::ConstexprField; // expected-error{{redeclaration of 'MemberRedecl::ConstexprField' cannot add 'dllexport' attribute}}
+#ifdef MS
+// expected-warning@+4{{attribute declaration must precede definition}}
+#else
+// expected-error@+2{{redeclaration of 'MemberRedecl::ConstexprField' cannot add 'dllexport' attribute}}
+#endif
+__declspec(dllexport) constexpr int MemberRedecl::ConstexprField;
#ifdef MS
struct __declspec(dllexport) ClassWithMultipleDefaultCtors {
@@ -841,7 +846,7 @@ struct MemTmplRedecl {
#if __has_feature(cxx_variable_templates)
template<typename T> static int StaticField; // expected-note{{previous declaration is here}}
template<typename T> static const int StaticConstField; // expected-note{{previous declaration is here}}
- template<typename T> constexpr static int ConstexprField = 1; // expected-note{{previous declaration is here}}
+ template<typename T> constexpr static int ConstexprField = 1; // expected-note-re{{previous {{(declaration|definition)}} is here}}
#endif // __has_feature(cxx_variable_templates)
};
@@ -855,7 +860,13 @@ template<typename T> __declspec(dllexport) void MemTmplRedecl::staticInli
#if __has_feature(cxx_variable_templates)
template<typename T> __declspec(dllexport) int MemTmplRedecl::StaticField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticField' cannot add 'dllexport' attribute}}
template<typename T> __declspec(dllexport) const int MemTmplRedecl::StaticConstField = 1; // expected-error{{redeclaration of 'MemTmplRedecl::StaticConstField' cannot add 'dllexport' attribute}}
-template<typename T> __declspec(dllexport) constexpr int MemTmplRedecl::ConstexprField; // expected-error{{redeclaration of 'MemTmplRedecl::ConstexprField' cannot add 'dllexport' attribute}}
+
+#ifdef MS
+// expected-warning@+4{{attribute declaration must precede definition}}
+#else
+// expected-error@+2{{redeclaration of 'MemTmplRedecl::ConstexprField' cannot add 'dllexport' attribute}}
+#endif
+template<typename T> __declspec(dllexport) constexpr int MemTmplRedecl::ConstexprField;
#endif // __has_feature(cxx_variable_templates)
@@ -1045,7 +1056,7 @@ struct CTMR /*ClassTmplMemberRedecl*/ {
static int StaticField; // expected-note{{previous declaration is here}}
static const int StaticConstField; // expected-note{{previous declaration is here}}
- constexpr static int ConstexprField = 1; // expected-note{{previous declaration is here}}
+ constexpr static int ConstexprField = 1; // expected-note-re{{previous {{(definition|declaration)}} is here}}
};
template<typename T> __declspec(dllexport) void CTMR<T>::normalDef() {} // expected-error{{redeclaration of 'CTMR::normalDef' cannot add 'dllexport' attribute}}
@@ -1060,7 +1071,12 @@ template<typename T> __declspec(dllexport) void CTMR<T>::staticInlineDecl
template<typename T> __declspec(dllexport) int CTMR<T>::StaticField = 1; // expected-error{{redeclaration of 'CTMR::StaticField' cannot add 'dllexport' attribute}}
template<typename T> __declspec(dllexport) const int CTMR<T>::StaticConstField = 1; // expected-error{{redeclaration of 'CTMR::StaticConstField' cannot add 'dllexport' attribute}}
-template<typename T> __declspec(dllexport) constexpr int CTMR<T>::ConstexprField; // expected-error{{redeclaration of 'CTMR::ConstexprField' cannot add 'dllexport' attribute}}
+#ifdef MS
+// expected-warning@+4{{attribute declaration must precede definition}}
+#else
+// expected-error@+2{{redeclaration of 'CTMR::ConstexprField' cannot add 'dllexport' attribute}}
+#endif
+template<typename T> __declspec(dllexport) constexpr int CTMR<T>::ConstexprField;
@@ -1120,7 +1136,7 @@ struct CTMTR /*ClassTmplMemberTmplRedecl*/ {
#if __has_feature(cxx_variable_templates)
template<typename U> static int StaticField; // expected-note{{previous declaration is here}}
template<typename U> static const int StaticConstField; // expected-note{{previous declaration is here}}
- template<typename U> constexpr static int ConstexprField = 1; // expected-note{{previous declaration is here}}
+ template<typename U> constexpr static int ConstexprField = 1; // expected-note-re{{previous {{(declaration|definition)}} is here}}
#endif // __has_feature(cxx_variable_templates)
};
@@ -1134,7 +1150,12 @@ template<typename T> template<typename U> __declspec(dllexport) void CTMT
#if __has_feature(cxx_variable_templates)
template<typename T> template<typename U> __declspec(dllexport) int CTMTR<T>::StaticField = 1; // expected-error{{redeclaration of 'CTMTR::StaticField' cannot add 'dllexport' attribute}}
template<typename T> template<typename U> __declspec(dllexport) const int CTMTR<T>::StaticConstField = 1; // expected-error{{redeclaration of 'CTMTR::StaticConstField' cannot add 'dllexport' attribute}}
-template<typename T> template<typename U> __declspec(dllexport) constexpr int CTMTR<T>::ConstexprField; // expected-error{{redeclaration of 'CTMTR::ConstexprField' cannot add 'dllexport' attribute}}
+#ifdef MS
+// expected-warning@+4{{attribute declaration must precede definition}}
+#else
+// expected-error@+2{{redeclaration of 'CTMTR::ConstexprField' cannot add 'dllexport' attribute}}
+#endif
+template<typename T> template<typename U> __declspec(dllexport) constexpr int CTMTR<T>::ConstexprField;
#endif // __has_feature(cxx_variable_templates)
// FIXME: Precedence rules seem to be different for classes.
OpenPOWER on IntegriCloud