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

            Bug ID: 87638
           Summary: [C++14] lambda init-capture fails for const references
                    still
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

The issue reported by PR 66735 still exists. GCC would not bind const-reference
init-captures to prvalues or xvalues.

### SOURCE (<stdin>):
const int &&f();
void g() { [&r = f()] { }(); }


### COMPILER INVOCATION COMMAND:
g++ -fsyntax-only -x c++ -std=c++14 -


### ACTUAL COMPILER OUTPUT:
<stdin>: In function 'void g()':
<stdin>:2:20: error: cannot capture 'f()' by reference


### EXPECTED COMPILER OUTPUT:
(Clean compile).


### COMPILER VERSION INFO (g++ -v):
Using built-in specs.
COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++
COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head
--enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl
--enable-checking=release --disable-nls --enable-lto
LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32
Thread model: posix
gcc version 9.0.0 20181016 (experimental) (GCC)

Reply via email to