bastring.h warning about operator delete

Greg Badros gjb@cs.washington.edu
Sat Jun 27 19:50:00 GMT 1998


With both egcs-1.2 and 1.3a (but not 1.1) and gcc-2.7.2, I get the
following warning message when building a .c files which includes a .h
file defining a class that uses class string from <string>:

(wrapped to <80 columns)

/uns/gcc-2.8.1/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/include/std/bastring.h:
In method `void
basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
>::Rep::release()': In file included from ClAbstractVariable.cc:12:
/uns/gcc-2.8.1/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/include/std/bastring.h:76:
warning: inline function `static void
basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
>::Rep::operator delete(void *)' called before definition


A gentleman in Paris notes the same warning on fr.comp.lang.c++.  See:


http://x2.dejanews.com/getdoc.xp?AN=361342096&CONTEXT=899001690.2049507365&hitnum=0

In bastring.h, release() does use delete before the inline definition:

...
  struct Rep {
    size_t len, res, ref;
    bool selfish;

    charT* data () { return reinterpret_cast<charT *>(this + 1); }
    charT& operator[] (size_t s) { return data () [s]; }
    charT* grab () { if (selfish) return clone (); ++ref; return data (); }
    void release () { if (--ref == 0) delete this; }

    inline static void * operator new (size_t, size_t);
    inline static void operator delete (void *);
    inline static Rep* create (size_t);
    charT* clone ();
....

I searched around for a bit, but don't know where else to look to see if 
this has been fixed or if it's even known to be a problem (I can try to
come up with a minimal test case if it's a new issue).

Please cc my on followups as I read mail more regularly than news.

Thanks,
Greg J. Badros
gjb@cs.washington.edu
Seattle, WA  USA
http://www.cs.washington.edu/homes/gjb


P.S. Great job on egcs!  It's incredibly useful to my work!



More information about the Gcc-bugs mailing list