[Bug c++/83160] New: [8 regression] lvalue required as unary ‘&’ operand

skpgkp1 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Nov 25 14:29:00 GMT 2017


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

            Bug ID: 83160
           Summary: [8 regression] lvalue required as unary ‘&’ operand
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skpgkp1 at gmail dot com
  Target Milestone: ---

Created attachment 42716
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42716&action=edit
Test case source file

This issue appear in HHVM build with GCC 8. GCC 7.2.1 works fine with attached
test case.

$ cat File.i.cpp
namespace a {
template <typename b> void ac(b, const b &);
}
int ag;
class c {
  c();
};
template <bool, class...> class C;
C<false> ak();
template <class, bool, class...> class d {
public:
  template <class an> void operator()(an &) const;
  template <class ao> void e(ao) {
    auto appender = [] {};
    (*this)(appender);
  }
  void f() { e(ag); }
};
template <bool, class...> class C : public d<int, 1> {};
template <class be, bool bd, class... aj>
template <class an>
void d<be, bd, aj...>::operator()(an &) const {
  constexpr int bj = 8;
  [](int bk) { a::ac(bk, bj); };
}
c::c() { ak().f(); }

### Fail with GCC 8.0

$g++ --version
g++ (GCC) 8.0.0 20171124 (experimental)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$g++  -ffunction-sections -fno-delete-null-pointer-checks  -std=gnu++1y
-fno-omit-frame-pointer -fno-operator-names -fdata-sections -fno-gcse
-fno-canonical-system-headers -mcrc32 -O3 --param max-inline-insns-auto=100
--param early-inlining-insns=200 --param max-early-inliner-iterations=50
--param=inline-unit-growth=200 --param=large-unit-insns=10000
-momit-leaf-frame-pointer -Wall -Wextra  -o File.i.cpp.o -c File.i.cpp -Wall
-Wextra
File.i.cpp: In instantiation of ‘void d< <template-parameter-1-1>, <anonymous>,
<template-parameter-1-3> >::operator()(an&) const [with an = d<
<template-parameter-1-1>, <anonymous>, <template-parameter-1-3> >::e(ao) [with
ao = int; <template-parameter-1-1> = int; bool <anonymous> = true;
<template-parameter-1-3> = {}]::<lambda()>; <template-parameter-1-1> = int;
bool <anonymous> = true; <template-parameter-1-3> = {}]’:
File.i.cpp:15:12:   required from ‘void d< <template-parameter-1-1>,
<anonymous>, <template-parameter-1-3> >::e(ao) [with ao = int;
<template-parameter-1-1> = int; bool <anonymous> = true;
<template-parameter-1-3> = {}]’
File.i.cpp:17:14:   required from ‘void d< <template-parameter-1-1>,
<anonymous>, <template-parameter-1-3> >::f() [with <template-parameter-1-1> =
int; bool <anonymous> = true; <template-parameter-1-3> = {}]’
File.i.cpp:26:17:   required from here
File.i.cpp:24:21: error: lvalue required as unary ‘&’ operand
   [](int bk) { a::ac(bk, bj); };
                ~~~~~^~~~~~~~



### Pass with GCC 7.2.1

$g++ --version
g++ (GCC) 7.2.1 20171124
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$g++  -ffunction-sections -fno-delete-null-pointer-checks  -std=gnu++1y
-fno-omit-frame-pointer -fno-operator-names -fdata-sections -fno-gcse
-fno-canonical-system-headers -mcrc32 -O3 --param max-inline-insns-auto=100
--param early-inlining-insns=200 --param max-early-inliner-iterations=50
--param=inline-unit-growth=200 --param=large-unit-insns=10000
-momit-leaf-frame-pointer -Wall -Wextra  -o File.i.cpp.o -c File.i.cpp -Wall
-Wextra
$ echo $?
0


More information about the Gcc-bugs mailing list