Virtual overloading of operator= causes warnings in dict

Dear all,

I have a class that is 1) templated and 2) inherits from another class. In both I have the operator= overloaded and virtual. I get warnings when I compile the dictionary and I don’t understand why. I have extracted a minimal example.

The parent class:

[code]class MonitorObject {

public:

virtual inline ~MonitorObject(){}
virtual MonitorObject& operator=(const MonitorObject& rhs){return(*this);}
//virtual MonitorObject& blob(const MonitorObject& rhs){return(*this);} // this is ok, just the name differs

protected:

MonitorObject(){}

ClassDef(MonitorObject, 7);

};[/code]

The inheriting class :

[code]template
class MonitorObjectScalar: public MonitorObject {

public:

virtual inline ~MonitorObjectScalar() {}
virtual MonitorObjectScalar& operator=(const MonitorObject& rhs){return(*this);}
//virtual MonitorObjectScalar& blob(const MonitorObject& rhs){return(*this);} // this is ok, just the name differs

private:

MonitorObjectScalar() {};

ClassDef(MonitorObjectScalar, 7);

};

typedef MonitorObjectScalar<Char_t> MonitorObjectChar;[/code]

The compilable code is attached (these classes plus the linkdef and the instructions on how to compile in the header).

When compiling with gcc 4.4 or 4.1 with -Woverloaded-virtual I get the following warning :

[quote]MonitorObject.h:14: warning: ‘virtual MonitorObject& MonitorObject::operator=(const MonitorObject&)’ was hidden
CoreDict.cpp:39: warning: by ‘ROOT::Shadow::MonitorObjectScalarlEchargR& ROOT::Shadow::MonitorObjectScalarlEchargR::operator=(const ROOT::Shadow::MonitorObjectScalarlEchargR&)’
MonitorObject.h: In instantiation of ‘MonitorObjectScalar& MonitorObjectScalar::operator=(const MonitorObject&) [with ScalarType = char]’:
CoreDict.cpp:1116: instantiated from here
[/quote]

A few notes :

  1. It does it only with operator overloading. If I use the same signature but use the function name “asdf” it doesn’t warn.
  2. If I add a subclass that is not templated, then i get no warnings either.

Is it something in my code or is it something in ROOT ?

Thank you
Barth
MonitorObject.h (1.26 KB)
CoreLinkDef.h (333 Bytes)

bump