------- Comment #6 from redi at gcc dot gnu dot org  2010-03-08 12:41 -------
You don't need a new warning to get what you want, as long as you put your
functions in a namespace:

// foo.h
namespace ns {
  void myfunc(const char*);
}

// foo.cpp
void ns::myfunc(const char* arg1)
{
    /* do stuff with arg1 */
}

Because the definition uses "ns::myfunc" you will get an error if there was not
a previous declaration in that namespace:

error: 'void ns::myfunc(const char*)' should have been declared inside 'ns'

So if you need to catch this at compile-time you can do it portably for all
compilers, simply by using the qualified name in the function definition.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43272

Reply via email to