[Bug c++/68821] New: g++ does not warn/error when virtual function return type is different than the one it overrides
bobby.prani at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Dec 9 17:51:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68821
Bug ID: 68821
Summary: g++ does not warn/error when virtual function return
type is different than the one it overrides
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bobby.prani at gmail dot com
Target Milestone: ---
Consider:
typedef void (*obj_t)(void);
class parent {
public:
struct obj_base {
virtual ~obj_base() {}
virtual void operator()(void)=0;
};
template <typename T> struct obj : public obj_base {
typedef void (T::*obj_t)(void);
T* p; obj_t f;
obj(T* p, obj_t f) : p(p), f(f) {}
int *operator()(void) {
return 0;
}
};
};
The overridden function has a different return type in the two cases. g++ does
not warn/error out about this.
More information about the Gcc-bugs
mailing list