Repository: microsoft/terminal (language: cpp)

Issue:
Bad code in src/terminal/parser/ft_fuzzer/fuzzing_directed.h
### Windows Terminal version

_No response_

### Windows build number

_No response_

### Other Software

_No response_

### Steps to reproduce

The code in question is on line 965:

`return (this->m_fFuzzed) ? &(this->m_t) : &CFuzzType<_Type, _Args...>::m_tInit;`

The Visual C++ compiler is correctly rejecting this code for two reasons: 1) the non-static data member '`m_tInit`' is protected so the attempt to create the pointer-to-member will fail; and 2) even if it succeeds there is no way the compiler can bring the types associated with the left and right expressions of the '`:`' operator to a common type. I suspect that the code should be:

`return (this->m_fFuzzed) ? &(this->m_t) : &(this->m_tInit);`

Thanks
JonCaves

### Expected Behavior

_No response_

### Actual Behavior

The code fails to compile with a recent build of the Visual C++ compiler


Discussion / hints:
What version of the tools are you using? This seems to compile fine with VS 17.3.0 Preview 2.0...

Most of https://github.com/microsoft/terminal/blob/main/src/terminal/parser/ft_fuzzer/fuzzing_directed.h has been unchanged since we went open source, but INTERESTINGLY, that specific line _was_ changed in #11816. In that PR, it was changed from what you suggest here to the current code. Link:https://github.com/microsoft/terminal/pull/11816/files#diff-5fbf1a284c85ac9a45b91d448ed5dc80ffc98cd56c82e9d40028e172d3681013L963

/cc @lhecker 
I am using the live compiler -- it will probably become 17.4 at some point. The intention of that PR appears to be to make the code more conformant and so in order for 2-phase name lookup to work for access to '`m_t`' and '`m_tInit`' they need to be made dependent -- and the best way to achieve this is to append '`this->`'. The syntax '`&CFuzzType<_Type, _Args...>::m_tInit`' creates a pointer-to-member - what is not what it wanted in this situation.

JonCaves

Fix patch:
diff --git a/src/terminal/parser/ft_fuzzer/fuzzing_directed.h b/src/terminal/parser/ft_fuzzer/fuzzing_directed.h
index 15a10a9ebdf..09cab7a19da 100644
--- a/src/terminal/parser/ft_fuzzer/fuzzing_directed.h
+++ b/src/terminal/parser/ft_fuzzer/fuzzing_directed.h
@@ -962,7 +962,7 @@ namespace fuzz
         __inline virtual _Type** operator&() throw()
         {
             m_ftEffectiveTraits |= TRAIT_TRANSFER_ALLOCATION;
-            return (this->m_fFuzzed) ? &(this->m_t) : &CFuzzType<_Type, _Args...>::m_tInit;
+            return (this->m_fFuzzed) ? &(this->m_t) : &(this->m_tInit);
         }
 
     private:


Test patch: