Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 77603 - System headers: <ksortablevaluelist.h> doesn't conform strict ANSI
Summary: System headers: <ksortablevaluelist.h> doesn't conform strict ANSI
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kdelibs
Version: 7.3
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Ngo Than
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-11-10 13:23 UTC by Sysoltsev Slawa
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2002-11-10 13:28:53 UTC

Attachments (Terms of Use)
Patch doing <ksortablevaluelist.h> ANSI C++ compatible (deleted)
2002-11-10 13:28 UTC, Sysoltsev Slawa
no flags Details | Diff

Description Sysoltsev Slawa 2002-11-10 13:23:00 UTC
Description of Problem:
Compiling kdevelop with Intel C/C++ compiler i received such error messages:

c++ -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/include/kde -I/usr/lib/qt3-
gcc2.96/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-
virtual-dtor -Wno-long-long -Wbad-function-cast -Wundef -Wall -pedantic -W -
Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -
D_BSD_SOURCE -Wcast-align -Wconversion -fno-builtin -g -O2 -O2 -march=i386 -
mcpu=i686 -DNDEBUG -DNO_DEBUG -D_GNU_SOURCE -fno-exceptions -fno-check-new -
ftemplate-depth-99 -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -Wp,-
MD,.deps/vartree.pp -c vartree.cpp  -fPIC -DPIC

/usr/include/kde/ksortablevaluelist.h(36): error: identifier "first" is 
          first  = i.first;

/usr/include/kde/ksortablevaluelist.h(37): error: identifier "second" is 
          second = i.second;

Problem here is that -ansi which causes strict ANSI checking is used. According 
to ANSI C++ standart code used in <ksortablevaluelist.h> is illegal.
Look at section 14.6.2 paragraph 3-4
of the C++ standard, it says "if a base class of [a class] template
depends on a template-parameter, the base class scope is not examined
during name lookup until the class template is instantiated..."

This is also discussed in core issue 213 which is 
described at:

GNU C/C++ compiler doesn't do really STRICT ANSI check so illegal code passes 
thru it successfully. But to increase Red Hat linux portability you should 
correct code in <ksortablevaluelist.h> conforming ANSI C++ standart. Workarund 
here is to access base class members "first" and "second" not by just name but 
as QPair<T,Key>::first and QPair<T,Key>::second. That is legal and possible way 
to access base class members in ANSI C++ mode. I'll attach the patch with 
changes in <ksortablevaluelist.h> to be ANSI C++ compatible - please take a 
look at it.

Version-Release number of selected component (if applicable):

How Reproducible:

Steps to Reproduce:
1. I'm afraid you won't be able to reproduce this bug because you don't have 
compiler I used.

Actual Results:
Compilation errors.

Expected Results:
Built kdevelop package.

Additional Information:

Comment 1 Sysoltsev Slawa 2002-11-10 13:28:47 UTC
Created attachment 84424 [details]
Patch doing <ksortablevaluelist.h> ANSI C++ compatible

Comment 2 Ngo Than 2002-11-10 19:27:27 UTC
I will add this fix in next build. Thanks for your patch.

Note You need to log in before you can comment on or make changes to this bug.