http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59950
Bug ID: 59950 Summary: Bogus diagnostic "taking address of temporary" taking address of trivial no-op assignment to temporary Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: richard-gccbugzilla at metafoo dot co.uk GCC rejects this valid code: struct Foo {}; int f(Foo *p); int n = f(&(Foo() = Foo())); ... saying ... <stdin>:3:27: error: taking address of temporary [-fpermissive] The incorrect diagnostic only appears if 'Foo' is empty and its assignment operator is defaulted. (Maybe the assignment is getting folded away before the check is performed?) Google ref b/12744615