[Bug c++/86187] New: Subscript operator applied to an temporary array results in an lvalue

zhonghao at pku dot org.cn gcc-bugzilla@gcc.gnu.org
Sun Jun 17 02:44:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86187

            Bug ID: 86187
           Summary: Subscript operator applied to an temporary array
                    results in an lvalue
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is as follow:

using Y = int[10];

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

The code comes from a discussion on Stackoverflow: 
http://stackoverflow.com/questions/33161003/using-a-temporary-array-as-an-lvalue 

The problem was reported to clang and it was fixed:
https://bugs.llvm.org/show_bug.cgi?id=25357

Although now clang provides diagnostic, gcc++ still does not provide any error
messages. Please fix the problem.


More information about the Gcc-bugs mailing list