Compiler takes wrong function signature

I have the following situation:
I am sending serialized struct over serial to pc and back. The struct is the following:

	typedef struct swingerParams
	{
		uint16_t swing_time;
		uint16_t top_duty_cycle_n;
		uint16_t top_duty_cycle_p;
		uint8_t power_iterations;
		uint8_t pull_percent;
		uint16_t speedup_end_t;
		int8_t shortened_swing_after_iter;
		uint16_t shortened_swing_duration;
	} SwingerParams;

Then I have functions for serialization and deserialization:

void Swinger::serialize(uint8_t *arr) const
{
	// Dummy variable for checking validity
	{
		uint8_t valid_entry = VALID_ENTRY;
		Var::disassembleVar(arr, valid_entry);
	}

	Var::disassembleVar(arr, getSwingTime());
	Var::disassembleVar(arr, getTopDutyCycleN());
	Var::disassembleVar(arr, getTopDutyCycleP());
	Var::disassembleVar(arr, getPowerIterations());
	Var::disassembleVar(arr, getPullPercent());
	Var::disassembleVar(arr, getSpeedupEndT());
	Var::disassembleVar(arr, getShortenedSwingAfterIter());
	Var::disassembleVar(arr, getShortenedSwingDuration());
}

bool Swinger::deserialize(const uint8_t *const arr)
{
	SwingerParams params;
	if (!deserialize(arr, params))
	{
		return false;
	}
	return setParams(params); // Sets params to arduino active variables
}

bool Swinger::deserialize(const uint8_t *arr, SwingerParams &params) const
{
	// Dummy variable for checking validity
	{
		uint8_t valid_entry = INVALID_ENTRY;
		Var::assembleVar(arr, valid_entry);
		switch (valid_entry)
		{
		case VALID_ENTRY:
			break;
		default:
			return false;
		}
	}

	Var::assembleVar(arr, params.swing_time);
	Var::assembleVar(arr, params.top_duty_cycle_n);
	Var::assembleVar(arr, params.top_duty_cycle_p);
	Var::assembleVar(arr, params.power_iterations);
	Var::assembleVar(arr, params.pull_percent);
	Var::assembleVar(arr, params.speedup_end_t);
	Var::assembleVar(arr, params.shortened_swing_after_iter);
	Var::assembleVar(arr, params.shortened_swing_duration);

	return true;
}

Then I made myself a helper for serializing and deserializing variables:

#ifndef VarFunctions_H
#define VarFunctions_H

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

namespace Var
{
	/**
	* @brief Read unsigned 8-bit variable from array, assign it to given variable and increment array pointer
	* @param arr: Array from which serialized object is to be restored (size is known constant)
	* @param var: Variable to which value from array is to be assigned
	* @retval None
	*/
	inline void assembleVar(const uint8_t *&arr, uint8_t &var)
	{
		var = *arr;
		++arr;
	}

	/**
	* @brief Read signed 8-bit variable from array, assign it to given variable and increment array pointer
	* @param arr: Array from which serialized object is to be restored (size is known constant)
	* @param var: Variable to which value from array is to be assigned
	* @retval None
	*/
	inline void assembleVar(const uint8_t *&arr, int8_t &var)
	{
		var = (int8_t)(*arr);
		++arr;
	}

	/**
	* @brief Read signed 16-bit variable from array, assign it to given variable and increment array pointer
	* @param arr: Array from which serialized object is to be restored (size is known constant)
	* @param var: Variable to which value from array is to be assigned
	* @retval None
	*/
	inline void assembleVar(const uint8_t *&arr, int16_t &var)
	{
		var = ((((int16_t)(arr[0])) << 8) | (arr[1]));
		arr += 2;
	}

	/**
	* @brief Read unsigned 16-bit variable from array, assign it to given variable and increment array pointer
	* @param arr: Array from which serialized object is to be restored (size is known constant)
	* @param var: Variable to which value from array is to be assigned
	* @retval None
	*/
	inline void assembleVar(const uint8_t *&arr, uint16_t &var)
	{
		var = ((((uint16_t)(arr[0])) << 8) | (arr[1]));
		arr += 2;
	}

	/**
	* @brief Read unsigned 32-bit variable from array, assign it to given variable and increment array pointer
	* @param arr: Array from which serialized object is to be restored (size is known constant)
	* @param var: Variable to which value from array is to be assigned
	* @retval None
	*/
	inline void assembleVar(const uint8_t *&arr, uint32_t &var)
	{
		var = ((((uint32_t)(arr[0])) << 24) | (((uint32_t)(arr[1])) << 16) | (((uint32_t)(arr[2])) << 8) | (arr[3]));
		arr += 4;
	}

	/**
	* @brief Write unsigned 8-bit variable to array and increment array pointer
	* @param arr: Array to write variable to (size is known constant)
	* @param var: Variable to be written
	* @retval None
	*/
	inline void disassembleVar(uint8_t *&arr, const uint8_t var)
	{
		*arr = var;
		++arr;
	}

	/**
	* @brief Write signed 8-bit variable to array and increment array pointer
	* @param arr: Array to write variable to (size is known constant)
	* @param var: Variable to be written
	* @retval None
	*/
	inline void disassembleVar(uint8_t *&arr, const int8_t var)
	{
		*arr = (uint8_t)var;
		++arr;
	}

	/**
	* @brief Write signed 16-bit variable to array and increment array pointer
	* @param arr: Array to write variable to (size is known constant)
	* @param var: Variable to be written
	* @retval None
	*/
	inline void disassembleVar(uint8_t *&arr, const int16_t var)
	{
		// Or memcpy?
		arr[0] = (uint8_t)((var >> 8) & 0xff);
		arr[1] = (uint8_t)(var & 0xff);
		arr += 2;
	}

	/**
	* @brief Write unsigned 16-bit variable to array and increment array pointer
	* @param arr: Array to write variable to (size is known constant)
	* @param var: Variable to be written
	* @retval None
	*/
	inline void disassembleVar(uint8_t *&arr, const uint16_t var)
	{
		// Or memcpy?
		arr[0] = (uint8_t)((var >> 8) & 0xff);
		arr[1] = (uint8_t)(var & 0xff);
		arr += 2;
	}

	/**
	* @brief Write unsigned 32-bit variable to array and increment array pointer
	* @param arr: Array to write variable to (size is known constant)
	* @param var: Variable to be written
	* @retval None
	*/
	inline void disassembleVar(uint8_t *&arr, const uint32_t var)
	{
		// Or memcpy?
		arr[0] = (uint8_t)((var >> 24) & 0xff);
		arr[1] = (uint8_t)((var >> 16) & 0xff);
		arr[2] = (uint8_t)((var >> 8) & 0xff);
		arr[3] = (uint8_t)(var & 0xff);
		arr += 4;
	}
} // namespace Var

#endif

Now everything worked fine until I added two last properties to the struct. One of them is int8_t. I did not have that helper in Var namespace, so I added it. But when I try to compile, I get the following error:

sketch\Swinger.cpp: In member function 'bool Swinger::deserialize(const uint8_t*, Swinger::SwingerParams&) const':
Swinger.cpp:406:31: error: cannot bind non-const lvalue reference of type 'int16_t& {aka int&}' to an rvalue of type 'int16_t {aka int}'
  Var::assembleVar(arr, params.shortened_swing_after_iter);
                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from sketch\Swinger.cpp:6:0:
C:\Users\user\Documents\Arduino\libraries\MyLibs/VarFunctions.h:41:14: note:   initializing argument 2 of 'void Var::assembleVar(const uint8_t*&, int16_t&)'
  inline void assembleVar(const uint8_t*& arr, int16_t& var)
              ^~~~~~~~~~~
exit status 1
cannot bind non-const lvalue reference of type 'int16_t& {aka int&}' to an rvalue of type 'int16_t {aka int}'

I dont know why is it trying to use int16_t function for int8_t variable. Could anyone help please?

An idea:

Check where you apply const in the parameters (try without const anywhere to see if there is a change - then you'll know that was your challenge)

Not 100% sure about this (it works because it’s only a byte...):var = (int8_t)(*arr);You might want to first cast the pointer to the right type, and only then grab the data

var = * ((int8_t *) arr);