This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/62052] function parameter has wrong address in lambda converted to pointer-to-function
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 07 Aug 2014 17:19:13 +0000
- Subject: [Bug c++/62052] function parameter has wrong address in lambda converted to pointer-to-function
- Auto-submitted: auto-generated
- References: <bug-62052-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62052
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.10.0, 4.7.4, 4.8.2, 4.9.1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Smaller testcase that aborts on error instead of printing addresses to stdout:
extern "C" void __attribute((noreturn)) abort();
struct X;
X const* objects[10];
int find(X const* x)
{
for (int i=0; i<10; ++i)
if (objects[i] == x)
return i;
abort();
}
struct X
{
X() {
objects[ find(nullptr) ] = this;
}
X(X const& x) {
find(&x);
objects[ find(nullptr) ] = this;
}
~X() {
objects[ find(this) ] = nullptr;
}
};
int main()
{
auto f = [] (X xx) { return xx; };
X (*ff) (X) = f;
ff ( X{} );
}