Red Hat Bugzilla – Bug 77767
Sources: kdevelop/kwrite/kwdialog.h isn't compatible with ANSI C++
Last modified: 2007-04-18 12:48:24 EDT
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
kwdialog.h(30): error: identifier "QComboBox" is undefined
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):
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.
Created attachment 84784 [details]
Patch doing <kwdialog.h> ANSI C++ compatible (#include added)
it's fixed in 2.1.5-1. thanks for your patch file.