[cfe-dev] ConditionalOperator: rvalue or lvalue?

Konstantin Tokarev annulen at yandex.ru
Wed Aug 21 01:53:19 PDT 2013


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?


-- 
Regards,
Konstantin



More information about the cfe-dev mailing list