This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70383] New: Bogus error when attempting to capture a reference to function by copy


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

            Bug ID: 70383
           Summary: Bogus error when attempting to capture a reference to
                    function by copy
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Repro:

void meow() {
    void purr();
    void (&f)() = purr;
    [f]{};
}

Per [expr.prim.lambda]/15, capturing a reference to a function by copy should
result in an unnamed data member that is also a reference to a function. GCC
instead complains:

prog.cc: In function 'void meow()':
prog.cc:4:6: error: field 'meow()::<lambda()>::<f capture>' invalidly declared
function type
     [f]{};
      ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]