[Bug c++/51317] New: Wrong value category of conditional expression where lvalue operands differ only in cv-qualification (see DR 587)

tsoae at mail dot ru gcc-bugzilla@gcc.gnu.org
Sat Nov 26 20:41:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51317

             Bug #: 51317
           Summary: Wrong value category of conditional expression where
                    lvalue operands differ only in cv-qualification (see
                    DR 587)
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tsoae@mail.ru


GCC 4.7.0 rejects the following application of address-of operator:

    int x = 1;
    int const y = 2;
    int const *p = &(1 ? x : y); // error: lvalue required as unary '&' operand

Such behavior was correct in C++03, but it is incorrect in C++11 - see
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#587



More information about the Gcc-bugs mailing list