I created a user-defined literal like this:
friend fraction operator "" _frac(long double val)
{
return fraction((float)val);
}
(Yes I know converting from long double to float is not good but I just do this for testing first and then fix that)
But then when I call like this:
fraction d= 1.0_frac; //error here
cout<<d;
The compiler (c++ 98) says:
[Error] invalid suffix "_frac" on floating constant
Is it because 1.0 is considered a float, not a long double?