question on template overload
Jonathan Wakely
jwakely.gcc@gmail.com
Fri Nov 21 16:33:00 GMT 2014
On 21 November 2014 14:25, Graziano Servizi <Graziano.Servizi@bo.infn.it> wrote:
> Hi, everybody
>
> I have already looked for an answer to my question on stackoverflow, finding
> this
>
> http://stackoverflow.com/questions/13649061/manual-select-overloaded-function-for-rvalue-or-lvalue-type
>
> and also looked among the known gcc bugs (without finding something useful);
> I have also read the standard as carefully as I can...
>
> so the question is:
>
> are known reasons leading the following silly code
>
> template <typename Z> void f(Z& z) {}
> template <typename Z> void f(Z&& z) {}
>
> int main()
> {
> double x = 0;
> f(x);
> f(0.0);
> }
>
> not being compiled by gcc 4.8.3 (without a const qualifier
> in the lvalue-reference parameter of the first overload) while clang 3.4
> does?
It's a bug, it works in GCC 4.9
More information about the Gcc-help
mailing list