Test() takes a reference, but you are passing it a temporary variable; specifically, the result of your dynamic_cast. This isn't allowed. You need to make Test() take a const reference, or first assign the dynamic_cast result to a variable before passing it to Test().
#include <iostream>
int GetInt(){ return 200; }
void Test(int & a){ a = 100; }
int main(int argc, char *argv[])
{
int i = GetInt();
Test(i); // works
//Test(GetInt()); // cannot convert parameter 1 from 'int' to 'int &'
return 0;
}