For this function:
void foo_ref(const int& i)
{
cout << i << endl;
}
It's failed when I call it in gdb:
(gdb) call foo_ref(5)
Attempt to take address of value not located in memory.
Of course, in this simple example there's no need to use reference as parameter. If I use a normal "int", no problem then.
Actually the real example is a template function, like this:
template<class T>
void t_foo_ref(const T& i)
{
cout << i << endl;
}
When "T" is "int", I have the problem mentioned above.
Is it a bug in gdb? Or is it possible I could call such function in gdb?