mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-07 23:13:01 -06:00
Make GCC 4.6.3 happy in C++0x mode
It complains about not finding a match for the pair<> template class, because the first parameter (this) is allegedly const. However, this isn't a const method, so I suspect it is a compiler bug. In order to move on, I slap on a harmless cast which will make this particular compiler happy, and which should have no effects elsewhere, but put it in a #if..#else..#endif macro to avoid warnings on others; hopefully this also makes it easier to spot and remove in the future.
This commit is contained in:
parent
88af4a4ce3
commit
d8dd982408
@ -761,16 +761,28 @@ namespace Opm
|
||||
wells_->ctrls[self_index_]->current = ~ wells_->ctrls[self_index_]->current;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// macro to insert const_cast to get a round bug in GCC 4.6.3 where it
|
||||
// suddenly believes that "this" is a const pointer, although we are not
|
||||
// in a const method.
|
||||
#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 6 ) && ( __GNUC_PATCHLEVEL__ == 3 )
|
||||
#define CONST_CAST(T,v) const_cast<T>(v)
|
||||
#else
|
||||
#define CONST_CAST(T,v) v
|
||||
#endif
|
||||
|
||||
std::pair<WellNode*, double> WellNode::getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
|
||||
const std::vector<double>& well_surfacerates_phase,
|
||||
ProductionSpecification::ControlMode mode)
|
||||
{
|
||||
const int np = phaseUsage().num_phases;
|
||||
const int index = self_index_*np;
|
||||
return std::make_pair<WellNode*, double>(this, rateByMode(&well_reservoirrates_phase[index],
|
||||
&well_surfacerates_phase[index],
|
||||
mode));
|
||||
// note: CONST_CAST is just to work around a bug in GCC 4.6.3; it
|
||||
// is not really needed, and should be a harmless no-op.
|
||||
return std::make_pair<WellNode*, double>(CONST_CAST(WellNode*,this),
|
||||
rateByMode(&well_reservoirrates_phase[index],
|
||||
&well_surfacerates_phase[index],
|
||||
mode));
|
||||
}
|
||||
|
||||
void WellNode::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,
|
||||
|
Loading…
Reference in New Issue
Block a user