diff --git a/build/boost/doc/limitations.qbk b/build/boost/doc/limitations.qbk index d7ec940..2d2ac44 100644 --- a/build/boost/doc/limitations.qbk +++ b/build/boost/doc/limitations.qbk @@ -95,7 +95,7 @@ The following code does not compile : MOCK_METHOD( method, 0 ) // this fails to compile because 'method' is not visible }; -The workaround would be to add the signature to MOCK_METHOD : +A workaround would be to add the signature to MOCK_METHOD : MOCK_BASE_CLASS( mock_base, base ) { @@ -104,6 +104,50 @@ The workaround would be to add the signature to MOCK_METHOD : [endsect] +[section Methods with a throw specifier cannot be mocked] + +The following code does not compile : + + namespace + { + struct base_class + { + virtual ~base_class() + {} + + virtual void method() throw; + }; + + MOCK_BASE_CLASS( mock_class, base_class ) + { + MOCK_METHOD( method, 0 ) // this fails to compile because of the throw specifier + }; + } + +A workaround would be to write a proxy member function : + + namespace + { + struct base_class + { + virtual ~base_class() + {} + + virtual void method() throw; + }; + + MOCK_BASE_CLASS( mock_class, base_class ) + { + void method() throw + { + method_proxy(); + } + MOCK_METHOD( method_proxy, 0, void(), method ) + }; + } + +[endsect] + [section Compilers without support for variadic macros fail on commas in MOCK_BASE_CLASS] For compilers without support for variadic macros the following code does not compile :