[cfe-dev] ConditionalOperator: rvalue or lvalue?

Eli Friedman eli.friedman at gmail.com
Wed Aug 21 02:37:32 PDT 2013


On Wed, Aug 21, 2013 at 1:53 AM, Konstantin Tokarev <annulen at yandex.ru>wrote:

>
> 20.08.2013, 22:19, "Eli Friedman" <eli.friedman at gmail.com>:
> > On Tue, Aug 20, 2013 at 10:57 AM, Konstantin Tokarev <annulen at yandex.ru>
> wrote:
> >> Hi all,
> >>
> >> In the code fragment [1] ConditionalOperator is lvalue in clang AST,
> while in code fragments [2] and [3] it is reported as rvalue. The
> difference is that [2] declares DEFAULT_WEIGHT as enum constant, and [3]
> declares it as int constant.
> >>
> >> Is this behavior correct? Why in [1] ConditionalOperator is not rvalue
> too?
> > This behavior is correct.  It isn't an rvalue because the C++ standard
> says it's an lvalue.
>
> Thank you!
>
> Is it solely because of 3.10.5 ("An expression which holds a temporary
> object resulting from a cast to a nonreference type is an rvalue"), or am I
> missing something else?
>
>
> Try [expr.cond]p3.

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130821/3dd3a8df/attachment.html>


More information about the cfe-dev mailing list