This is an archive of the discontinued LLVM Phabricator instance.

PR26448: [Sema] Fix determined type of ternary operator acting on two xvalue class types
ClosedPublic

Authored by erik.pilkington on Feb 19 2016, 8:34 AM.

Details

Reviewers
rsmith
Summary

Previously, when the 2 expressions passed to a ternary operator were xvalues and one inherits from the other, the resulting expression had type 'T', not 'T&&' as 5.16p3 dictates. For example:
`
Base b; Derived d;
typedef decltype(true ? static_cast<Base&&>(b) : static_cast<Derived&&>(d)) x; // x has type Base, not Base&&`

PR: https://llvm.org/bugs/show_bug.cgi?id=26448

Diff Detail

Event Timeline

erik.pilkington retitled this revision from to PR26448: [Sema] Fix determined type of ternary operator acting on two xvalue class types.
erik.pilkington updated this object.
erik.pilkington added a reviewer: rsmith.
erik.pilkington added a subscriber: cfe-commits.

Fix the ill-generated diff. Would someone mind taking a look at this?

rsmith accepted this revision.Mar 18 2016, 8:35 AM
rsmith edited edge metadata.

LGTM, thanks!

lib/Sema/SemaExprCXX.cpp
4698

This should say: "... must bind directly to an lvalue."

This revision is now accepted and ready to land.Mar 18 2016, 8:35 AM
erik.pilkington edited edge metadata.

Fix the wording of the quoted section of the standard. Would you mind committing this? Thanks for reviewing!

rsmith closed this revision.Apr 25 2016, 12:36 PM

Committed as r267454.