[Bug c/44677] Warn for variables incremented but not used

stormbyte at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Sep 19 10:03:22 GMT 2022


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

David Manuelda <stormbyte at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stormbyte at gmail dot com

--- Comment #14 from David Manuelda <stormbyte at gmail dot com> ---
It is worth to notice that this bug propagates to C++ whenever an object uses
an int that increments but is never used, like the following example:

class Test{
        public:
                Test() { i = 0; i++; }
        private:
                int i;
};

int main(int, char**) {
        Test unused;

        return 0;
}


More information about the Gcc-bugs mailing list