Bug 77603 - System headers: <ksortablevaluelist.h> doesn't conform strict ANSI
Summary: System headers: <ksortablevaluelist.h> doesn't conform strict ANSI
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kdelibs
Version: 7.3
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Than Ngo
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
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:
Clone Of:
Environment:
Last Closed: 2002-11-10 13:28:53 UTC
Embargoed:


Attachments (Terms of Use)
Patch doing <ksortablevaluelist.h> ANSI C++ compatible (1.64 KB, patch)
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 
undefined
          first  = i.first;
          ^

/usr/include/kde/ksortablevaluelist.h(37): error: identifier "second" is 
undefined
          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:
http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/cwg_defects.html#213.

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:
always

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.