help with gcc 4.3 failure on xbsql

Hans de Goede j.w.r.degoede at hhs.nl
Tue Mar 11 15:28:59 UTC 2008


Jakub Jelinek wrote:
> On Tue, Mar 11, 2008 at 10:53:48AM -0400, Tom spot Callaway wrote:
>> One of my packages is failing to build with gcc 4.3, and the error seems
>> lodged in C++ and bison, and I can't quite see how to fix it.
>>
>> Help me interwebs, you are my only hope:
>>
>> https://bugzilla.redhat.com/show_bug.cgi?id=434439
>>
>> Essentially, the failure is:
>>
>> g++ -DHAVE_DLFCN_H=1 -DPACKAGE=\"xbsql\" -DVERSION=\"0.10\" -I. -I.
>> -UNO_READLINE -I/usr/local/include -g -c xbsql.tab.c -MT xbsql.tab.lo
>> -MD -MP -MF .deps/xbsql.tab.TPlo  -fPIC -DPIC -o .libs/xbsql.tab.lo
>> mv -f .libs/xb_datetime.lo xb_datetime.lo
>> In file included from xbsql.y:719:
>> xbsql.l: In function 'int xbsql_lex()':
>> xbsql.l:13: error: reference to 'string' is ambiguous
>> xbsql.y:14: error: candidates are: void string(int)
>> /usr/lib/gcc/x86_64-redhat-linux/4.3.0/../../../../include/c
>> ++/4.3.0/bits/stringfwd.h:60: error:                 typedef struct
>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>> std::string
> 
> It uses xbase headers, which apparently do using namespace std;

Thats my fault, the xbase headers used to have "include <iostream.h>", 
which AFAIK implied "using namespace std;", so since those headers were 
in their old form dragging in namespace std, I thought it would be ok to 
also drag it in the gcc-4.3 "fix". But I agree it would be better to fix 
the headers to not do "using namespace std;", add std:: to the headers 
where needed and add "using namespace std;" to the xbase .cpp files.

Regards,

Hans


> at global scope, not sure if from laziness or for what other reasons.
> When global scope has using namespace std;, defining functions
> like void string(int) at global scope is of course a problem, as
> std namespace provides std::string class.
> 
> So, either fix xbase, so that using namespace std; is only
> used in .cpp sources and headers use explicit std::* scoping instead,
> or rename the string function in xbsql to something that doesn't
> clash with namespace std symbols.
> 
> 	Jakub
> 




More information about the fedora-devel-list mailing list