How to issue a warning if a C++ template is defined as 'inline' or 'static'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all:

Sometimes, when I convert a function to a C++ template, I forget to remove the 'static' or 'inline' attributes:

template< typename IntegerType >
static inline  // Unnecessary
IntegerType my_template ( IntegerType v )
{
  return v;
}

int main ( void )
{
  return my_template( 123 );
}

Such 'static' and 'inline' attributes do not make sense for a template, do they? Or do they actually have an effect?

Is there a way to make GCC issue warnings about them? At the very least, it would save some head scratching during code reviews.

Thanks in advance,
  rdiez



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux