Make the Fruit deprecated marker work in Visual Studio.
diff --git a/include/fruit/component.h b/include/fruit/component.h
index 5f37262..f07209b 100644
--- a/include/fruit/component.h
+++ b/include/fruit/component.h
@@ -484,7 +484,7 @@
* As in the example, the template parameters will be inferred by the compiler, it's not necessary to specify them explicitly.
*/
template<typename... Params>
- FRUIT_DEPRECATED(
+ FRUIT_DEPRECATED_DECLARATION(
PartialComponent<fruit::impl::OldStyleInstallComponent<Component<Params...>>, Bindings...>
install(const Component<Params...>& component)
);
diff --git a/include/fruit/impl/component.defn.h b/include/fruit/impl/component.defn.h
index 2d1f01c..72612e3 100644
--- a/include/fruit/impl/component.defn.h
+++ b/include/fruit/impl/component.defn.h
@@ -235,8 +235,9 @@
template <typename... Bindings>
template <typename... OtherCompParams>
+FRUIT_DEPRECATED_DEFINITION(
inline PartialComponent<fruit::impl::OldStyleInstallComponent<Component<OtherCompParams...>>, Bindings...>
-PartialComponent<Bindings...>::install(const Component<OtherCompParams...>& other_component) {
+PartialComponent<Bindings...>::install(const Component<OtherCompParams...>& other_component)) {
using Op = OpFor<fruit::impl::OldStyleInstallComponent<Component<OtherCompParams...>>>;
(void)typename fruit::impl::meta::CheckIfError<Op>::type();
return {{storage, other_component.storage}};
diff --git a/include/fruit/impl/fruit-config.h b/include/fruit/impl/fruit-config.h
index ec243ed..3ff8a2f 100644
--- a/include/fruit/impl/fruit-config.h
+++ b/include/fruit/impl/fruit-config.h
@@ -66,14 +66,20 @@
#define FRUIT_ALWAYS_INLINE
#endif
-#if FRUIT_HAS_ATTRIBUTE_DEPRECATED
-#define FRUIT_DEPRECATED(...) [[deprecated]] __VA_ARGS__
-#elif FRUIT_HAS_GCC_ATTRIBUTE_DEPRECATED
-#define FRUIT_DEPRECATED(...) __VA_ARGS__ __attribute__((deprecated))
+#if FRUIT_HAS_GCC_ATTRIBUTE_DEPRECATED
+#define FRUIT_DEPRECATED_DECLARATION(...) __VA_ARGS__ __attribute__((deprecated))
+// Marking the declaration is enough.
+#define FRUIT_DEPRECATED_DEFINITION(...) __VA_ARGS__
#elif FRUIT_HAS_DECLSPEC_DEPRECATED
-#define FRUIT_DEPRECATED(...) __declspec(deprecated) __VA_ARGS__
+#define FRUIT_DEPRECATED_DECLARATION(...) __declspec(deprecated) __VA_ARGS__
+#define FRUIT_DEPRECATED_DEFINITION(...) __declspec(deprecated) __VA_ARGS__
+// We use this only if the above two are not supported, because some compilers "support" this syntax (i.e., it compiles) but they just ignore the attribute.
+#elif FRUIT_HAS_ATTRIBUTE_DEPRECATED
+#define FRUIT_DEPRECATED_DECLARATION(...) [[deprecated]] __VA_ARGS__
+#define FRUIT_DEPRECATED_DEFINITION(...) [[deprecated]] __VA_ARGS__
#else
-#define FRUIT_DEPRECATED(...) __VA_ARGS__
+#define FRUIT_DEPRECATED_DECLARATION(...) __VA_ARGS__
+#define FRUIT_DEPRECATED_DEFINITION(...) __VA_ARGS__
#endif
#endif // FRUIT_CONFIG_H