From: Ivan Maidanski Date: Tue, 13 Sep 2016 18:53:08 +0000 (+0300) Subject: Eliminate 'class defines member variable with name also defined in parent' cppcheck... X-Git-Tag: v7.6.2~372 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=014e7817b31d42e34277b04147a1f66be3df18ff;p=gc Eliminate 'class defines member variable with name also defined in parent' cppcheck warning * tests/test_cpp.cc (F::nFreed, F::nAllocated): Add 'F' suffix to field name (to avoid hiding the similar one in the parent class). --- diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc index 0edc20ef..ca45dc11 100644 --- a/tests/test_cpp.cc +++ b/tests/test_cpp.cc @@ -170,19 +170,25 @@ class F: public E {public: member with clean-up. */ F() { - nAllocated++;} + nAllocatedF++; + } + ~F() { - nFreed++;} + nFreedF++; + } + static void Test() { - my_assert( nFreed >= .8 * nAllocated ); - my_assert( 2 * nFreed == E::nFreed );} + my_assert(nFreedF >= .8 * nAllocatedF); + my_assert(2 * nFreedF == nFreed); + } E e; - static int nFreed; - static int nAllocated;}; + static int nFreedF; + static int nAllocatedF; +}; -int F::nFreed = 0; -int F::nAllocated = 0; +int F::nFreedF = 0; +int F::nAllocatedF = 0; GC_word Disguise( void* p ) {