<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In the below code the compiler throws "undeclared identifier" when the commented line is uncommented. Whereas the line just before compiles fine.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Manu</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div><br>
</div>
<div>typedef bool (* DummyFunc) ();</div>
<div><br>
</div>
<div><br>
</div>
<div>bool ExecDummy (DummyFunc fptr) {</div>
<div><br>
</div>
<div> if (fptr)</div>
<div> return fptr ();</div>
<div><br>
</div>
<div> return false;</div>
<div>}</div>
<div><br>
</div>
<div>constexpr unsigned int IsMyAppClient = 0;</div>
<div><br>
</div>
<div>constexpr bool CheckForTypeClient (unsigned int pAppType)</div>
<div>{</div>
<div> return ((pAppType & IsMyAppClient) != 0);</div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>class MyAppTemplate</div>
<div>{</div>
<div>public:</div>
<div> template <unsigned int T></div>
<div> static bool MyAppInit ();</div>
<div>};</div>
<div><br>
</div>
<div>template <unsigned int T></div>
<div>bool</div>
<div>MyAppTemplate::MyAppInit ()</div>
<div>{</div>
<div> if constexpr (CheckForTypeClient(T)) {</div>
<div><br>
</div>
<div><b> return ClientMain (); // no error</b></div>
<div><b> //return ExecDummy(ClientMain); // error: use of undeclared identifier 'ClientMain'</b></div>
<div> }</div>
<div><br>
</div>
<div> return false;</div>
<div>}</div>
<div><br>
</div>
<div>int __cdecl</div>
<div>main (int pArgc, char* pArgv[])</div>
<div>{</div>
<div> constexpr int TVal = 3;</div>
<div><br>
</div>
<div> MyAppTemplate::MyAppInit<TVal> ();</div>
<div><br>
</div>
<div> return 0;</div>
<div>}</div>
<br>
<br>
</div>
</body>
</html>