[LLVMbugs] [Bug 18731] New: lifetime-extension of conditional temporaries isn't quite right

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 4 16:05:25 PST 2014


            Bug ID: 18731
           Summary: lifetime-extension of conditional temporaries isn't
                    quite right
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

(See core issue 1299 for the full rules.)


  bool b;
  struct S { S(int); ~S(); };
  struct T { S s = 0; };
  S &&r = b ? static_cast<S&&>(T().s) : static_cast<S&&>(S(2));

Here, we should lifetime-extend the T object or the S object, depending on
which arm of the conditional is selected. Currently, we lifetime-extend

While we're here, we fail to lifetime extend in this case:

  using T = int[3];
  //int &&r = T{}[0];
  int &r = T{}[0];

... but we should. (We also reject the commented code because we classify the
array indexing as an lvalue rather than an xvalue; that's a different DR.)

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140205/23418c5b/attachment.html>

More information about the llvm-bugs mailing list