From 7c75ecaef441e951a1b9240c5400e2947f190d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 2 Oct 2020 23:22:49 +0200 Subject: [PATCH] Workaround AppleClang bug by renaming TestHasher constructor argument As far as I understand the standard, if there is a function called `rng` in the global namespace, and a function argument called `rng`, then the argument should shadow the function. This then means that uses of `rng` inside the function should refer to the argument. This is not the case for AppleClang 12.0.0. Luckily the workaround is simple enough; just rename the argument. Given that the function is 3 lines and uncomplicated, the change of the name doesn't really affect readability. Still, WTF AppleClang? Closes #2030 --- include/internal/catch_test_case_registry_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_test_case_registry_impl.cpp b/include/internal/catch_test_case_registry_impl.cpp index 065f70bd..b337ee3e 100644 --- a/include/internal/catch_test_case_registry_impl.cpp +++ b/include/internal/catch_test_case_registry_impl.cpp @@ -22,10 +22,10 @@ namespace Catch { namespace { struct TestHasher { - explicit TestHasher(Catch::SimplePcg32& rng) { - basis = rng(); + explicit TestHasher(Catch::SimplePcg32& rng_instance) { + basis = rng_instance(); basis <<= 32; - basis |= rng(); + basis |= rng_instance(); } uint64_t basis;