mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Workaround internal gcc compiler error
It needs to be tested against the latest gcc trunk and a gcc bug report raised if the problem still exists.
This commit is contained in:
@@ -30,7 +30,23 @@ namespace BlackMisc
|
||||
CAircraftEngine CAircraftEngineList::getEngine(int engineNumber) const
|
||||
{
|
||||
Q_ASSERT(engineNumber >= 0);
|
||||
return this->findBy(&CAircraftEngine::getNumber, engineNumber).frontOrDefault();
|
||||
|
||||
// The following commented line results in a gcc compiler segfault:
|
||||
//
|
||||
// internal compiler error: in size_binop_loc, at fold-const.c:1450
|
||||
// } // namespace
|
||||
// ^
|
||||
//
|
||||
// frontOrDefault() is defined as:
|
||||
// static const value_type def; return empty() ? def : front();
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// Workaround it by using non static const value instead.
|
||||
|
||||
//return this->findBy(&CAircraftEngine::getNumber, engineNumber).frontOrDefault();
|
||||
|
||||
const CAircraftEngine def;
|
||||
auto results = this->findBy(&CAircraftEngine::getNumber, engineNumber);
|
||||
return results.empty() ? def : front();
|
||||
}
|
||||
|
||||
bool CAircraftEngineList::isEngineOn(int engineNumber) const
|
||||
|
||||
Reference in New Issue
Block a user