https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80456
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The test() call is represented as *(volatile struct A *) this, A::test () and the *this dereference in that case is what triggers the error (well, this itself). This is created by: 8827 /* In an expression of the form `a->f()' where `f' turns 8828 out to be a static member function, `a' is 8829 none-the-less evaluated. */ 8830 if (TREE_CODE (TREE_TYPE (fn)) != METHOD_TYPE 8831 && !is_dummy_object (instance) 8832 && TREE_SIDE_EFFECTS (instance)) 8833 call = build2 (COMPOUND_EXPR, TREE_TYPE (call), 8834 instance, call); So shall we have some exception of *this if it is volatile and still ignore it?