This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question on template overload


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]