* Fix issues exposed by building with MSVC and /permissive-.
Using full-qualified name to declare members inside class is ill-formed and incorrectly allowed by MSVC.
MSVC now gives error when /permissive- is used.
* Add a forward declaration for SafeAddRef from utilcode.h.
SafeAddRef in holder.h calls SafeAddRef in utilcode.h. The latter hasn't been declared yet, so it isn't a valid candidate during overload resolution.
It happens to work in MSVC default mode because of the lack of two phase name lookup.
Commit migrated from https://github.com/dotnet/coreclr/commit/
0ad57d9177ac88aabbf9354b985c5ac192a307e7
// Holder-specific clr::SafeAddRef and clr::SafeRelease helper functions.
namespace clr
{
+ // Copied from utilcode.h. We can't include the header directly because there
+ // is circular reference.
+ // Forward declare the overload which is used by 'SafeAddRef' below.
+ template <typename ItfT>
+ static inline
+ typename std::enable_if< std::is_pointer<ItfT>::value, ItfT >::type
+ SafeAddRef(ItfT pItf);
+
template < typename ItfT > __checkReturn
ItfT *
SafeAddRef(ReleaseHolder<ItfT> & pItf)