diff --git a/include/fruit/impl/injector.defn.h b/include/fruit/impl/injector.defn.h index c2e2d884..32dc73a8 100644 --- a/include/fruit/impl/injector.defn.h +++ b/include/fruit/impl/injector.defn.h @@ -105,7 +105,8 @@ inline Injector::RemoveAnnotations Injector::get() { template template -inline Injector::RemoveAnnotations* Injector::unsafeGet() { +inline +FRUIT_DEPRECATED_DEFINITION(Injector::RemoveAnnotations* Injector::unsafeGet()) { return storage->template unsafeGet(); } diff --git a/include/fruit/injector.h b/include/fruit/injector.h index 3ec33f99..abe6b296 100644 --- a/include/fruit/injector.h +++ b/include/fruit/injector.h @@ -163,7 +163,9 @@ class Injector { * notes, and if you used this method you'll have to check that the existing uses still work. */ template - RemoveAnnotations* unsafeGet(); + FRUIT_DEPRECATED_DECLARATION( + RemoveAnnotations* unsafeGet() + ); /** * This is a convenient way to call get(). E.g.: diff --git a/tests/test_binding_compression.py b/tests/test_binding_compression.py index e17975c0..53c15737 100755 --- a/tests/test_binding_compression.py +++ b/tests/test_binding_compression.py @@ -153,7 +153,8 @@ def test_compression_undone(): ''' expect_success( COMMON_DEFINITIONS, - source) + source, + ignore_deprecation_warnings=True) if __name__== '__main__': main(__file__) diff --git a/tests/test_injector_unsafe_get.py b/tests/test_injector_unsafe_get.py index cb47501a..701c71aa 100755 --- a/tests/test_injector_unsafe_get.py +++ b/tests/test_injector_unsafe_get.py @@ -69,7 +69,18 @@ def test_success(XAnnot, YAnnot, ZAnnot): expect_success( COMMON_DEFINITIONS, source, - locals()) + locals(), + ignore_deprecation_warnings=True) + +def test_unsafe_get_deprecated(): + source = ''' + struct X {}; + + void f(fruit::Injector<> injector) { + injector.unsafeGet(); + } + ''' + expect_generic_compile_error('deprecation|deprecated', COMMON_DEFINITIONS, source) if __name__== '__main__': main(__file__)