Community
Participate
Working Groups
The following minimal example gives a semantic error but compiles just fine using gcc (see code comments for the location of the error): class A { public: void f() { } }; template <class T> class B : public A { public: using A::f; // This seems to be ignored but should put A::f() in the scope of class B where it can be overloaded by A::f(int) instead of being hidden. void f(int) { } }; int main(int, char**) { B<float> obj_B; obj_B.f(3); obj_B.f(); // Wrong problem marker: Invalid arguments ' Candidates are: void f(int) ' return 0; } This doesn't occur in the following example, where class B is not a template: class A { public: void f() { } }; class B : A // Not a template. { public: using A::f; void f(int) { } }; int main(int, char**) { B obj_B; obj_B.f(3); obj_B.f(); // No problem marker here. return 0; } The using declaration is supposed to prevent B::f(int) from hiding A::f() but overloading it instead. This concept is also described here: http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Foverload_member_fn_base_derived.htm and discussed here: http://stackoverflow.com/questions/3202234/overloaded-functions-are-hidden-in-derived-class The problem also occurs in more complex examples where the derived class extends a class template or there is a chain of inheritance of several classes. I make heavy use of such function overloads in a template library and because those problem markers show up at every call to one of those functions, the whole project is littered with them although it compiles and runs fine. I would really appreciate if this one could be fixed. I used the newest Eclipse (Windows 32 Bit) release from the eclipse.org download site: Eclipse IDE for C/C++ Developers Version: Indigo Release Build id: 20110615-0604 Eclipse C/C++ Development Tools Version: 8.0.0.201106081058 Build id: 201106081058 Windows 7 Professional (64 bit) Service Pack 1 Processor: AMD Athlon(tm) 64 X2 Dual Core Processor 4000+ 2.10 GHz Installed memory (RAM): 2,00 GB The .log is attached for details. java full version "1.7.0-b147" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
Thanks for the sample code, added testcase and fix.