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

--- Comment #7 from Thiago Macieira <thiago at kde dot org> ---
(In reply to Martin Liška from comment #6)
> Anyway, upstream removed the pure attribute as we suggested:
> https://codereview.qt-project.org/c/qt/qtbase/+/392357

Can we be assured the pure attribute will work for complex return types?

https://gcc.godbolt.org/z/KE4s74od3
struct S
{
    bool *ptr;
    S();
    S(const S &);
};

#ifdef __GNUC__
__attribute__((pure))
#endif
S f1();
bool f2()
{
    return *f1().ptr;
}

Reply via email to