Bug 77767 - Sources: kdevelop/kwrite/kwdialog.h isn't compatible with ANSI C++
Summary: Sources: kdevelop/kwrite/kwdialog.h isn't compatible with ANSI C++
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kdevelop
Version: 7.3
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2002-11-13 10:36 UTC by Sysoltsev Slawa
Modified: 2007-04-18 16:48 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-01-26 15:27:50 UTC

Attachments (Terms of Use)
Patch doing <kwdialog.h> ANSI C++ compatible (#include added) (253 bytes, patch)
2002-11-13 10:43 UTC, Sysoltsev Slawa
no flags Details | Diff

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 

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

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.

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