error: no match for 'operator=' (operand types are 'CFileVar<unsigned char>' and

This is another compile error I just don’t understand.

error: no match for ‘operator=’ (operand types are ‘CFileVar’ and ‘uint8_t {aka unsigned char}’)

What is the compiler complaining about exactly? The data types match!

In my ino file - the code in bold is generating the compiler error.

#define REBOOT    (uint8_t)0
#define HTTP_REQ  (uint8_t)2
#define TIMER     (uint8_t)3
#define MANUAL    (uint8_t)4
CFileVar<uint8_t> nWakeupType("wake", eUInt8);


void wakeupCommon()
{
  nPowerDownTrigger = millis() + nInactivityTime;
  PowerManager.detachInterrupts();
  resetESP();
  WifiManager.begin();
}

void wakeupHTTPISR()
{
  wakeupCommon();
  PowerManager.turnOnDevices();
  PowerManager.turnOffDevices();
  [b]nWakeupType = HTTP_REQ;[/b]
  nWakeupType.save();
}
typedef enum {eBool, eChar, eInt8, eUInt8, eInt16, eUInt16, eInt32, eUInt32, eFloat, eDouble, eString} enumDataType;

template<class T>
class CFileVar
{
	public:
		// Construction, destruction and initialisation
		CFileVar(const char* strName, enumDataType eDataType);
		CFileVar(const __FlashStringHelper* strName, enumDataType eDataType);
		virtual ~CFileVar();

		// Interface
		void set(T &tVal);
		void save();
		void restore();

		// Operators
		T& operator =(T &tVal);
		operator T&()
		{
		  return m_tVal;
		}

	protected:
		// Data
		CBuff<9> m_buff;
		CString m_strFilename;
		static uint8_t m_nVarNum;
		T m_tVal;
		enumDataType m_eDataType;
};




template<class T>
uint8_t CFileVar<T>::m_nVarNum = 1;

template<class T>
CFileVar<T>::CFileVar(const char* strName, enumDataType eDataType)
{
	m_strFilename = strName;
	m_strFilename += F(".txt");
	m_eDataType = eDataType;
	restore();
}

template<class T>
CFileVar<T>::CFileVar(const __FlashStringHelper* strName, enumDataType eDataType)
{
	m_strFilename = strName;
	m_strFilename += F(".txt");
	m_eDataType = eDataType;
	restore();
}

template<class T>
CFileVar<T>::~CFileVar()
{
}

template<class T>
void CFileVar<T>::save()
{
	if (SD.exists(m_strFilename))
	{
		CTextFile file;
		if (file.open(m_strFilename, REWRITE))
		{
			file.writeLine(m_tVal);
			file.close();
		}
		else
			debug.logFileOpenError(m_strFilename);
	}
	else
		debug.logFileFoundError(m_strFilename);
}

template<class T>
void CFileVar<T>::restore()
{
	CBuff<17> buff;
	CString strVal(buff);

	if (SD.exists(m_strFilename))
	{
		CTextFile file;
		if (file.open(m_strFilename, READ))
		{
			file.readLine(strVal);

			if (m_eDataType == eBool)
				m_tVal = strVal == F("1");
			else if (m_eDataType == eChar)
				m_tVal = strVal[0];
			else if ((m_eDataType == eInt8) && (m_eDataType == eInt16) && (m_eDataType == eInt32))
				m_tVal = strVal.toInt();
			else if ((m_eDataType == eUInt8) && (m_eDataType == eUInt16) && (m_eDataType == eUInt32))
				m_tVal = strVal.toInt();
			else if ((m_eDataType == eFloat) || (m_eDataType == eDouble))
				m_tVal = strVal.toReal();
			else if (m_eDataType == eString)
				m_tVal = strVal;

			file.close();
		}
	}
}

template<class T>
void CFileVar<T>::set(T &tVal)
{
	m_tVal = tVal;
}

template<class T>
T& CFileVar<T>::operator =(T &tVal)
{
	set(tVal);
	return m_tVal;
}

Never mind I worked it out in the end.

The compile error was a red herring and had nothing to do with the actual data type.

It was actually related to the references to the data type that i have in my template class.