Red Hat Bugzilla – Bug 998477
Bad throwspec in ~LuceneBase destructor (g++-4.8 error)
Last modified: 2014-10-25 18:17:10 EDT
Description of problem:
When attempting to unbundle clucene09 from qt5-qttools, we ran into the following build error:
In file included from /usr/include/clucene09/CLucene/index/IndexReader.h:15:0,
/usr/include/clucene09/CLucene/store/FSDirectory.h:92:5: error: looser throw specifier for ‘virtual lucene::store::FSDirectory::FSIndexInput::SharedHandle::~SharedHandle() throw (CLuceneError&)’
In file included from /usr/include/clucene09/CLucene/debug/mem.h:14:0,
/usr/include/clucene09/CLucene/debug/lucenebase.h:61:13: error: overriding ‘virtual lucene::debug::LuceneBase::~LuceneBase() noexcept (true)’
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Try to build qt5-qttools on F19 or Rawhide with the patch from https://bugzilla.redhat.com/show_bug.cgi?id=915005#c36
FTBFS with the above error.
The problem is that the virtual ~LuceneBase() destructor must not be noexcept because at least 1 subclass does throw exceptions in the destructor. So I think that noexcept in lucenebase.h needs to go away.
Unfortunately, I am not a C++ programmer, thus I would like to see a patch
proposed - which also does not break something else.
If my repoquery was correct, then only zarafa depends on clucene09.
Created attachment 788030 [details]
I think Kevin meant this change instead my original idea of dropping the throw() in the child class.
Yes, this change should be right.
I guess g++ 4.8 now assumes that destructors with no throwspec are throw() (i.e. throw nothing) rather than "throw anything". (There must be some obscure clause somewhere in the C++ standard which says that.)
I need this fix to finish qt5-qttools review, so will take a crack at applying the proposed patch for rawhide and how it goes.
* Tue Aug 27 2013 Rex Dieter <firstname.lastname@example.org> 0.9.21b-7
- Bad throwspec in ~LuceneBase destructor (#998477)
I botched -7, in that it didnt actually apply the patch, -8 on the way.
Arg, build failed,
started adding more throw items to more headers,
../src/CLucene/index/CompoundFile.cpp:97:41: error: declaration of ‘virtual lucene::index::CompoundFileReader::~CompoundFileReader()’ has a different exception specifier
../src/CLucene/index/CompoundFile.h:98:2: error: from previous declaration ‘virtual lucene::index::CompoundFileReader::~CompoundFileReader() throw (CLuceneError&)’
../src/CLucene/index/Term.cpp:84:13: error: declaration of ‘virtual lucene::index::Term::~Term()’ has a different exception specifier
../src/CLucene/index/Term.h:71:2: error: from previous declaration ‘virtual lucene::index::Term::~Term() throw (CLuceneError&)’
../src/CLucene/store/FSDirectory.cpp:371:29: error: declaration of ‘virtual lucene::store::FSDirectory::~FSDirectory()’ has a different exception specifier
../src/CLucene/store/FSDirectory.h:158:3: error: from previous declaration ‘virtual lucene::store::FSDirectory::~FSDirectory() throw (CLuceneError&)’
../src/CLucene/store/RAMDirectory.cpp:222:31: error: declaration of ‘virtual lucene::store::RAMDirectory::~RAMDirectory()’ has a different exception specifier
../src/CLucene/store/RAMDirectory.h:134:11: error: from previous declaration ‘virtual lucene::store::RAMDirectory::~RAMDirectory() throw (CLuceneError&)’
../src/CLucene/store/TransactionalRAMDirectory.cpp:19:57: error: declaration of ‘virtual lucene::store::TransactionalRAMDirectory::~TransactionalRAMDirectory()’ has a different exception specifier
../src/CLucene/store/TransactionalRAMDirectory.h:47:13: error: from previous declaration ‘virtual lucene::store::TransactionalRAMDirectory::~TransactionalRAMDirectory() throw (CLuceneError&)’
I suppose I need to figure out how to change the declarations accordingly in the .cpp files too?
Created attachment 791139 [details]
more intrusive version
Here's a more intrusive version I needed to use to get things to build.
clucene09-0.9.21b-8.fc19 has been submitted as an update for Fedora 19.
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing clucene09-0.9.21b-8.fc19'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
clucene09-0.9.21b-8.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.
For the record, it seems that g++ ≥ 4.8 only assumes noexcept(true) in C++11 mode, and in that mode, it is possible to write noexcept(false) to disable that, so I changed the patch to do that: