Similarly, you cannot do this:
struct foo { void bar(); }; const foo f; f.bar();
You cannot do this:
struct baz { void qax(); }; volatile baz g; g.qax();
You must cv-qualify functions:
struct foo { void bar() const; }; struct baz { void qax() volatile; }; const foo f; f.bar();
So for you:
void reset() volatile { x = 0; }
source share