Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #548

C++11 Ranking implicit conversion sequences (13.3.3.2)

Message-ID <k4852m$2bs3$1@adenine.netfront.net> (permalink)
Newsgroups comp.std.c++
From michael@mehlich.com
Subject C++11 Ranking implicit conversion sequences (13.3.3.2)
Organization Netfront http://www.netfront.net/
Date 2012-09-30 21:17 -0600

Show all headers | View raw


The standard (actually earlier versions as well as the current github
draft) provide the following statement in 13.3.3.2 for comparing
conversion sequences:

"Standard conversion sequence S1 is a better conversion sequence than
standard conversion sequence S2 if ...
S1 and S2 are reference bindings (8.5.3) and neither refers to an
implicit object parameter of a non-static member function declared
without a ref-qualifier, and S1 binds an rvalue reference to an
rvalue and S2 binds an lvalue reference."

This is immediately followed by the example:
  int g(const int&);
  int g(const int&&);
  int j = g(i); // calls g(const int &)
which is a preference of binding an lvalue reference to an lvalue over
binding an rvalue reference to an lvalue.

The above statement does not say anything about this preference, nor
could I find any other statement in 13.3.3.2 that would provide this
preference.

Did I miss something somewhere?
What is the correct resolution rule for this?

If it is "prefer binding an lvalue reference to an lvalue over
binding an rvalue reference to an lvalue" then the next statement
in the standard becomes obsolete as it just imposes an additional
restriction to functions...

--
  Michael



--- news://freenews.netfront.net/ - complaints: news@netfront.net ---


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextNext in thread | Find similar


Thread

C++11 Ranking implicit conversion sequences (13.3.3.2) michael@mehlich.com - 2012-09-30 21:17 -0600
  Re: C++11 Ranking implicit conversion sequences (13.3.3.2) Daniel Krügler <daniel.kruegler@googlemail.com> - 2012-10-02 02:57 -0600

csiph-web