Bug 77767

Summary: Sources: kdevelop/kwrite/kwdialog.h isn't compatible with ANSI C++
Product: [Retired] Red Hat Linux Reporter: Sysoltsev Slawa <vyatcheslav.sysoltsev>
Component: kdevelopAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: low Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-01-26 15:27:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch doing <kwdialog.h> ANSI C++ compatible (#include added) none

Description Sysoltsev Slawa 2002-11-13 10:36:01 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Description of problem:
Compiling kdevelop source by Intel C/C++ compiler I've received such error 
message:

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 -Wp,-MD,.deps/kwview.pp -c kwview.cpp  -fPIC -DPIC
kwdialog.h(29): error: identifier "QComboBox" is undefined
      QComboBox *search;
      ^

kwdialog.h(30): error: identifier "QComboBox" is undefined
      QComboBox *replace;
      ^

compilation aborted for kwview.cpp (code 2)

Problem here is that "-ansi -pedantic" comand-line options cause strict ANSI 
C++ checking. According to ANSI C++, code in kwdialog.h is illegal, because 
class QComboBox isn't declared evidently in included Qt headers (you forgot 
<qcombobox.h>) and declared only in class QListBoxItem (qlistbox.h) as friend 
class - you can ensure in it looking preprocessed file. This is enough for C++ 
without ANSI check but no enough for strict ANSI dialect. Look at section 11.4 
paragraph 2 of the C++ standart: "A class shall not be defined in a friend 
declaration.", also paragraph 7: "A name nominated by a friend declaration 
shall be accessible in the scope of the class containing the friend 
declaration."
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 <kwdialog.h> conforming ANSI C++ standart. Workaround here is 
add #include <qcombobox.h> to list of kwdialog.h includes. I'll attach the 
patch with this modification - please 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 the error because you don't have 
compiler I used and this error doesn't appear with current GNU C/C++ compiler.
	

Actual Results:  Compilation error.

Expected Results:  Biult package.

Additional info:

Comment 1 Sysoltsev Slawa 2002-11-13 10:43:29 UTC
Created attachment 84784 [details]
Patch doing <kwdialog.h> ANSI C++ compatible (#include added)

Comment 2 Ngo Than 2003-01-26 15:27:50 UTC
it's fixed in 2.1.5-1. thanks for your patch file.