libstdc++/8550: undefined reference to fill and fill_n

Gabriel Dos Reis gdr@integrable-solutions.net
Tue Nov 19 18:08:00 GMT 2002


The following reply was made to PR libstdc++/8550; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: "Brian T. N. Gunney" <gunney@tux75.llnl.gov>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/8550: undefined reference to fill and fill_n
Date: 12 Nov 2002 20:36:13 +0100

 "Brian T. N. Gunney" <gunney@tux75.llnl.gov> writes:
 
 | >State:          open
 | >Class:          sw-bug
 
 This is user confusion.
 
 [...]
 
 | The fill and fill_n functions are missing when compiled with -fno-implicit-template,
 | leading to an error at link time.
 
 Which matches the documented behaviour.
 
 | 
 | This is similar to bug 8172, in which I reported a missing operator+ for strings.
 | >How-To-Repeat:
 | 	
 | Program text:
 | #include <algorithm>
 | using namespace std;
 | int main() {
 |   double x[10];
 |   fill_n( x, 10, 1.0 );
 |   fill( x, x+10, 2.0 );
 |   return 0;
 | }
 | 
 | Compile command:
 | g++ -fno-implicit-templates  nofill.cc
 
 The above tells g++ not to implicitly instantiate the required
 definitions.  Which means you *ought* to manually provide them --
 usually through explicit instantiation.  
 
 The simple way fo fix this is: don't do that.
 
 -- Gaby



More information about the Gcc-prs mailing list