[PING^2] [C/C++] PR c/4076 -Wunused doesn't warn about static function only called by itself

Gabriel Dos Reis gdr@cs.tamu.edu
Fri Mar 16 15:21:00 GMT 2007


Nathan Sidwell <nathan@codesourcery.com> writes:

| Manuel López-Ibáñez wrote:
| 
| > I could but I was not able to construct a case where it was necessary.
| > How can a static function make a scoped recursive call? Sorry my
| > knowledge of C++ is not so good.
| 
| namespace { struct X { void Foo () { X::Foo (); }}}
| 
| might just cut it.

I think the same would apply member functions of local classes, no?

| Yes I know anonymous namespaces are not quite the
| same as static, and I don't know if we'll check this, but it seems
| wise to copy the idiom you've introduced.

speaking of unnamed namespaces member being treated "static", a
regression was introduced recently where the compiler will reject use
of unnamed namespace members as template arguments.

-- Gaby



More information about the Gcc-patches mailing list