basic_string<....>

Jody Goldberg jodyg@idt.net
Fri Oct 10 08:51:00 GMT 1997


On Thu, Oct 09, 1997 at 01:12:48PM -0700, H.J. Lu wrote:
> While doing "make check" in libstdc++ on egcs 971008, I got
> 
> /home/work/gnu/src/egcs/libstdc++/testsuite/libstdc++.tests/../../tests/tstring.cc:154: undefined reference to `basic_string<char, string_char_traits<char> > & basic_string<char, string_char_traits<char> >::replace<int *>(char *, char *, int *, int *)'
> 
> Both of them do not make any senses to me. Does anyone have a patch or
> did I something wrong?
> 

This is the result of enabling member function templates.

As noted in previous posts strings are rather messed up right now.  If you
comment out the 2 new tests in tstring.cc from the 970929 things will compile.
If you then disable exceptions the test runs as expected.

Using 970908 on solaris2.5.1-sparc there appears to be a strange interaction
between enabling exceptions and the basic_string classes.  This manifests
itself in 2 ways.


    1) gdb reports that 
	basic_string & basic_string::assign (const charT* s, size_type n)
	{
	    return replace (0, npos, s, n);
	}

       Calls the member function template version for no apparent reason.
       
    2) The member template immediately throws an exception which trys to create
       a string which recurses itself to death.
       
Disable exceptions at the top of bastring.h and things revert to normal.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jodyg@idt.net  | By definition all answers are replies. Unfortunately,
               | not all replies are answers.  -- JMS



More information about the Gcc mailing list