Enable safe matcher casts from Matcher<const T&> to Matcher<T>.

PiperOrigin-RevId: 715826130
Change-Id: Id962fd456f6da21ea2a909f331f92d814f1dad46
This commit is contained in:
Abseil Team
2025-01-15 09:16:57 -08:00
committed by Copybara-Service
parent 504ea69cf7
commit e4ece4881d
4 changed files with 96 additions and 17 deletions
+2 -2
View File
@@ -936,8 +936,8 @@ casts a matcher `m` to type `Matcher<T>`. To ensure safety, gMock checks that
floating-point numbers), the conversion from `T` to `U` is not lossy (in
other words, any value representable by `T` can also be represented by `U`);
and
3. When `U` is a reference, `T` must also be a reference (as the underlying
matcher may be interested in the address of the `U` value).
3. When `U` is a non-const reference, `T` must also be a reference (as the
underlying matcher may be interested in the address of the `U` value).
The code won't compile if any of these conditions isn't met.