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

            Bug ID: 103403
           Summary: Decltype of rvalue reference
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: enricomaria.dean6elis at gmail dot com
                CC: anders.granlund.0 at gmail dot com,
                    daniel.kruegler at googlemail dot com, jason at gcc dot 
gnu.org,
                    mpolacek at gcc dot gnu.org, trippels at gcc dot gnu.org,
                    webrown.cpp at gmail dot com
  Target Milestone: ---

Unlike the comment at the end of the original report claims, the bug seems to
be still present (or at least a different shade of it).

StackOverflow question:
https://stackoverflow.com/questions/70092776/validity-of-presenting-an-xvalue-as-an-lvalue
Repro: https://godbolt.org/z/h943G933a


+++ This bug was initially created as a clone of Bug #78209 +++

This came up on the isocpp mailing list yesterday:

markus@x4 /tmp % cat test.ii
int main() {
  int &&i = 0;
  decltype(auto) j = i;
  return j;
}

markus@x4 /tmp % clang++ test.ii
test.ii:3:18: error: rvalue reference to type 'int' cannot bind to lvalue of
type 'int'
  decltype(auto) j = i;
                 ^   ~
1 error generated.

markus@x4 /tmp % icpc test.ii
test.ii(3): error: an rvalue reference cannot be bound to an lvalue
    decltype(auto) j = i;
                       ^
compilation aborted for test.ii (code 2)

markus@x4 /tmp % g++ -Wall -Wextra test.ii
markus@x4 /tmp %

Reply via email to