Originally posted by: camorton
The problem is with the && operator used in the static initializer, the compiler is trying to handle the case where we only evaluate one side. I can get a clean compile by eliminating it.
last bit of preprocessed file with WA macro showing the workaround
1) add lhs and rhs static members to hold the expression from each side of the && operator
2) initialise the original static with lhs && rhs instead of the original expressions
namespace rtm {
namespace trace {
# 26 "/home/cibo4/src/RTM-AllStars/RTM/trace/objective_function/l2norm.h"
class L2Norm : public ObjectiveFunction, protected TransformationFromReferenceCommons
{
public:
explicit L2Norm(const trace_map_type &references = trace_map_type());
float operator()(const trace_list_type &input) const;
ObjectiveFunction::clone_type clone(const trace_map_type &reference_traces) const;
memento_type create_memento() const;
void set_state(memento_type token);
private:
class Memento : public SerializableMemento { public: void deserialize(const boost::filesystem::path & path); void serialize(const boost::filesystem::path & path) const; bool has_state() const { return false; } void create_template(const boost::filesystem::path & path) const { } friend class L2Norm; };
static bool m_is_registered;
#ifdef WA
static bool lhs;
static bool rhs;
#endif
};
}
}
# 2 "/home/cibo4/src/RTM-AllStars/RTM/trace/objective_function/l2norm.cpp" 2
using namespace std;
namespace rtm {
namespace trace {
#ifdef WA
bool L2Norm::lhs( factory_type::get_instance().register_prototype("L2Norm", make_shared<L2Norm>()) );
bool L2Norm::rhs( factory_type::get_instance().register_prototype("L2Projection", make_shared<L2Norm>()) );
bool L2Norm::m_is_registered(L2Norm::lhs && L2Norm::rhs);
#else
bool L2Norm::m_is_registered(
factory_type::get_instance().register_prototype("L2Norm", make_shared<L2Norm>()) &&
factory_type::get_instance().register_prototype("L2Projection", make_shared<L2Norm>())
);
#endif
}
}
#Ask-Question-Here--General-Compiler-Q-and-A#C/C++andFortran