Files
gcc-reflection/gcc/testsuite/g++.dg/cpp1y/lambda-generic-empty1.C
Jason Merrill bdbca69e07 c++: generic lambda, fn* conv, empty class [PR98326]
Here, in the thunk returned from the captureless lambda conversion to
pointer-to-function, we try to pass through invisible reference parameters
by reference, without doing a copy.  The empty class copy optimization was
messing that up.

gcc/cp/ChangeLog:

	PR c++/98326
	PR c++/20408
	* cp-gimplify.c (simple_empty_class_p): Don't touch an invisiref
	parm.

gcc/testsuite/ChangeLog:

	PR c++/98326
	* g++.dg/cpp1y/lambda-generic-empty1.C: New test.
2021-02-08 20:51:51 -05:00

10 lines
138 B
C

// PR c++/98326
// { dg-do compile { target c++14 } }
struct A {
A() = default;
A(const A&) {}
};
void (*fptr)(A) = [](auto){};