Bug 77603 - System headers: <ksortablevaluelist.h> doesn't conform strict ANSI
System headers: <ksortablevaluelist.h> doesn't conform strict ANSI
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: kdelibs (Show other bugs)
7.3
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Ngo Than
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-11-10 08:23 EST by Sysoltsev Slawa
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-11-10 08:28:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch doing <ksortablevaluelist.h> ANSI C++ compatible (1.64 KB, patch)
2002-11-10 08:28 EST, Sysoltsev Slawa
no flags Details | Diff

  None (edit)
Description Sysoltsev Slawa 2002-11-10 08:23:00 EST
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 08:28:47 EST
Created attachment 84424 [details]
Patch doing <ksortablevaluelist.h> ANSI C++ compatible
Comment 2 Ngo Than 2002-11-10 14:27:27 EST
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.