Double initialization of Property removes Property
Consider the following code:
class PropertyAlg : public Algorithm {
private:
Gaudi::Property<std::string> m_string{ this, "String", "hundred" };
};
PropertyAlg::PropertyAlg( const std::string& name, ISvcLocator* ploc ) :
Algorithm( name, ploc ),
m_string( name ) {
}
Naively I would have expected that the value of the String
property gets overwritten with name
as one would expect for PODs. However, the actual result is quite different:
$ ctest -R GaudiTestSuite.pytest.properties.test_all_py
AttributeError: 'PropertyAlg' object has no attribute 'String'
Obviously, the fix is easy and one should use assignment m_string = name
instead. But I wonder if we can either make the above code fail to compile or do what the user would expect.