[llvm-bugs] [Bug 25357] New: Subscript operator applied to an temporary array results in an lvalue

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 30 11:18:48 PDT 2015


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

            Bug ID: 25357
           Summary: Subscript operator applied to an temporary array
                    results in an lvalue
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yaghmour.shafik at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This Stackoverflow question
http://stackoverflow.com/questions/33161003/using-a-temporary-array-as-an-lvalue
provides the following code:

using Y = int[10];

int main() {
    (Y { })[0] = 1;
}

which compiles without diagnostic, if I am reading CWG defect report 1213
correctly http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1213
then the result of the  subscript operator should be an xvalue and therefore
not assignable to. Is this a correct interpretation?

The clang defect report status page does list the status of DR 1213 as unknown
http://clang.llvm.org/cxx_dr_status.html but since this has come up on a couple
of SO questions already I thought it was worth it to file a bug report.

I have a Wandbox example here
http://melpon.org/wandbox/permlink/tiLfQnvsvBsAtNZv

-- 
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/20151030/e6ab86f8/attachment.html>


More information about the llvm-bugs mailing list