https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93540
Trass3r <trass3r at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |trass3r at gmail dot com
--- Comment #2 from Trass3r <trass3r at gmail dot com> ---
I also ran into this when trying to optimize trivial but expensive getter
functions, e.g. returning shared_ptr.
struct Foo
{
int operator+(const Foo& f);
int a;
};
[[gnu::const]]
Foo foo(); // int instead of Foo works
auto testfunction()
{
return foo() + foo(); // results in 2 calls
}