This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

CVS g++ new warning [-Winline -Werror -O1]



I'm seeing this oddness:

cc1plus: warnings being treated as errors
kill1.cc: In method `typename _Traits::int_type basic_streambuf<_CharT,
kill1.cc: _Traits>::overflow (typename _Traits::int_type) [with _CharT
kill1.cc: = char, _Traits = char_traits<char>]':
kill1.cc:20: warning: function with static variable cannot be inline

This kind of construct appears repeatedly in the v-3 codebase. Because
of the instability in the main tree, I'd not compiled v-3 with the CVS
g++ in a bit--when I switched to alpha and started working with a
gcc/g++ that will bootstrap, I found this new warning. Since -Werror
is on by default, I got scads of fails. I've also reproduced it on
x86/linux with CVS cc1plus.

The warning is confusing to me: what does it mean? There is no static
variable. I'm assuming the generated diagnostic is bogus. If not, can
somebody please explain it to me? If so, can it please be removed?

When did this start appearing?

thanks,
benjamin


// 2000-03-08 CVS gcc
// -------test.cc
// g++ -c -Winline -Werror -O1 test.cc

  template<class _CharT>
    struct char_traits
    {
      typedef unsigned long  	int_type;
  
      static int_type 
      eof() { return static_cast<int_type>((-1)); }

    };

  template<typename _CharT, typename _Traits = char_traits<_CharT> >
    class basic_streambuf 
    {
    public:
      typedef typename _Traits::int_type 		int_type;
      typedef _Traits 					traits_type;
 
      virtual int_type 
      overflow(int_type /* __c */ = traits_type::eof())
      { return traits_type::eof(); }
    };

  typedef basic_streambuf<char> 	streambuf;

namespace std
{
    template<typename _Tp>
    void
    foo(const _Tp& __x)
    { streambuf __s; }

    template
    void
    foo(const float&);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]