This is the mail archive of the
mailing list for the GCC project.
Re: A problem related to const rvalue
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: chmodexplorer at sina dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 20 Mar 2012 15:56:40 +0000
- Subject: Re: A problem related to const rvalue
- References: <20120320031321.26D7E45EE81@webmail.sinamail.sina.com.cn>
> Is it a bug or by design? Who can answer the question for me?
This list is for discussing the development of GCC not for help using
it, so this is the wrong mailing list for your question. It would be
more appropriate on the gcc-help mailing list, please take an
follow-up there, thanks.
I believe G++ is correct, the relevant text is in [basic.lval] where
the standard says that "Class prvalues can have cv-qualified types;
non-class prvalues always have cv-unqualified types." The result of
the function f2() is a prvalue, so has type int, with no
If you repeat the experiment with functions returning a class type
instead of int then you should see the behaviour you expect where f(
f2() ) will call f(const X&&)