mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 17:55:45 +08:00
Several gcc and clang fixes
This superseeds also f1199793 by a cleaner workaround.
This commit is contained in:
committed by
Roland Winklmeier
parent
70e42c0bee
commit
ab98009996
@@ -33,7 +33,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
BlackMisc::Aviation::CCallsign CRemoteAircraftSelector::getSelectedCallsign() const
|
BlackMisc::Aviation::CCallsign CRemoteAircraftSelector::getSelectedCallsign() const
|
||||||
{
|
{
|
||||||
const CCallsign empty;
|
const CCallsign empty {};
|
||||||
int index = ui->cb_RemoteAircraftSelector->currentIndex();
|
int index = ui->cb_RemoteAircraftSelector->currentIndex();
|
||||||
if (index < 0 || index > this->m_aircraft.size()) { return empty; }
|
if (index < 0 || index > this->m_aircraft.size()) { return empty; }
|
||||||
return m_aircraft[index].getCallsign();
|
return m_aircraft[index].getCallsign();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace BlackMisc
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
CAircraftEngine() = default;
|
CAircraftEngine() {}
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CAircraftEngine(int number, bool on);
|
CAircraftEngine(int number, bool on);
|
||||||
|
|||||||
@@ -30,23 +30,7 @@ namespace BlackMisc
|
|||||||
CAircraftEngine CAircraftEngineList::getEngine(int engineNumber) const
|
CAircraftEngine CAircraftEngineList::getEngine(int engineNumber) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(engineNumber >= 0);
|
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
|
bool CAircraftEngineList::isEngineOn(int engineNumber) const
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ namespace BlackMisc
|
|||||||
/*!
|
/*!
|
||||||
* \brief Access the first element, or a default-initialized value if the sequence is empty.
|
* \brief Access the first element, or a default-initialized value if the sequence is empty.
|
||||||
*/
|
*/
|
||||||
const_reference frontOrDefault() const { static const value_type def; return empty() ? def : front(); }
|
const_reference frontOrDefault() const { static const value_type def {}; return empty() ? def : front(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Access the first element, or a default-initialized value if the sequence is empty.
|
* \brief Access the first element, or a default-initialized value if the sequence is empty.
|
||||||
|
|||||||
Reference in New Issue
Block a user