mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	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
This commit is contained in:
		@@ -23,10 +23,10 @@ namespace Catch {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
    struct HashTest {
 | 
					    struct HashTest {
 | 
				
			||||||
        explicit HashTest(SimplePcg32& rng) {
 | 
					        explicit HashTest(SimplePcg32& rng_inst) {
 | 
				
			||||||
            basis = rng();
 | 
					            basis = rng_inst();
 | 
				
			||||||
            basis <<= 32;
 | 
					            basis <<= 32;
 | 
				
			||||||
            basis |= rng();
 | 
					            basis |= rng_inst();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        uint64_t basis;
 | 
					        uint64_t basis;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user