Boost logo

Boost :

From: Gustavo Guerra (gustavobt_at_[hidden])
Date: 2002-01-27 13:21:13


----- Original Message -----
From: "Douglas Gregor" <gregod_at_[hidden]>

> GCC emits a warning when it encounters a class with only private member
> functions, so the following patch adds a dummy public function to silence
GCC.
>
> Doug
>
> Index: boost_no_priv_aggregate.cxx
> ===================================================================
> RCS file:
/cvsroot/boost/boost/libs/config/test/boost_no_priv_aggregate.cxx,v
> retrieving revision 1.3
> diff -c -3 -p -r1.3 boost_no_priv_aggregate.cxx
> *** boost_no_priv_aggregate.cxx 2001/09/19 20:24:40 1.3
> --- boost_no_priv_aggregate.cxx 2002/01/27 17:59:48
> *************** struct t
> *** 17,22 ****
> --- 17,23 ----
> private:
> void foo(){ i = j; }
> public:
> + void bar(){ j = i; } // silences warning from GCC
> int i;
> int j;
> };
>

Why don't you instead add
  void bar() {}
Does GCC still warn when the function doesn't do anything?

Gustavo Guerra


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk