[Bug c++/122048] New: unevaluated use of non-static data member rejected in generic lambda

herring at lanl dot gov gcc-bugzilla@gcc.gnu.org
Tue Sep 23 22:15:01 GMT 2025


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

            Bug ID: 122048
           Summary: unevaluated use of non-static data member rejected in
                    generic lambda
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: herring at lanl dot gov
  Target Milestone: ---

Given

class X {
  void f();
  int i;
};
void X::f() {[&](auto) {sizeof i;}(1);}

GCC trunk complains about "invalid use of non-static data member 'X::i'", but
the unevaluated expression should be valid even with an explicit this-> and
even without a capture-default at all.


More information about the Gcc-bugs mailing list