question on template overload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

The diagnostic says that the first function call is ambiguous:
what about partial ordering? By the way clang resolves the two function calls by calling the first and second overload respectively.

In stackoverflow it is said that this code is C++11 standard compliant...


Thanks for your attention.

                        G. Servizi






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux