Latest MetaTrader upgrade: Operator not behaving as expected...

 

Hello All,


With the latest MT5 update, I am hitting something I don't understand; a little script to illustrate the compiler warning am hitting:
#include <Internal\TimeSpan\TimeSpan.mqh>

/* Note: from <Internal\TimeSpanTimeSpan.mqh>:
   void operator=(const TimeSpan &t)
     {
      this.m_ticks=t.Ticks();
     }
*/

class CTestTimeSpan
  {
public:
   static const TimeSpan DefaultTimeout;
   static const TimeSpan InfiniteTimeout;

  };

static const TimeSpan   CTestTimeSpan::InfiniteTimeout(0,0,0,0,-1);
static const TimeSpan   CTestTimeSpan::DefaultTimeout=CTestTimeSpan::InfiniteTimeout;

//+------------------------------------------------------------------+ 
//| Script program start function                                    | 
//+------------------------------------------------------------------+ 
void OnStart() 
{ 
   printf("%s[%d], %s: Hello world", __FILE__, __LINE__, __FUNCTION__);
}

I receive the following compiler warning:

'struct TimeSpan' initialized from type type 'const TimeSpan' using assignment operator, this behavior is deprecated and will be removed in future

The '=' operator in TimeSpan.mqh looks OK to me, please will someone let me know what is wrong/offer a fix?

With my best regards, ESB.

 

Ignore the warning for now as it will certainly be fixed in a next update.

Or modify the copy constructor in TimeSpan :

   //+------------------------------------------------------------------+
   //| Constructor with parameters.                                     |
   //+------------------------------------------------------------------+  
                     TimeSpan(const TimeSpan &value)
     {
      m_ticks=value.Ticks();
     }
 

Thank you Alain, noted.

WMBR, ESB.