Why following code doesn't compile in C++14 compiler? If I use
const int i = 10;
int n = fun(i);
The compiler gives an error.
But, If I use
int n = fun(10);
instead of above statements, it's working fine.
Example:
template<typename T>
int fun(const T&&)
{
cout<<"fun"<<endl;
}
int main()
{
// int i = 10; // Not work
const int i = 10; // Not work
int n = fun(i);
// int n = fun(10); // Working fine
}