For gcc version 4.1.0

Using built-in specs.
Target: djgpp
Configured with: /gnu/gcc-4.10/configure djgpp
--prefix=/dev/env/DJDIR --disable -nls --disable-werror
--enable-languages=c,c++,fortran,objc,obj-c++,ada
Thread model: single
gcc version 4.1.0

Without -fpermissive the compiler do not see members of base class,
declared with template<>.
Consider:

namespace Pv{
template<class Tobj>
struct Derived
{
        virtual char    method(char *const)=0;
        char            is_ok(){ return 1; }
};}

namespace Ptest{ template <class Tobj>
struct Derived: public Pv::Derived<Tobj>
{

   char method(char *const ptr)
    {
     return ( ptr && is_ok() )? 1: 0;
     /*
1.cpp: In member function 'char Ptest::Derived<Tobj>::method(char*)':
1.cpp:15: error: there are no arguments to 'is_ok' that depend on a
template parameter, so a declaration of 'is_ok' must be available
1.cpp:15: error: (if you use '-fpermissive', G++ will accept your code,
but allowing the use of an undeclared name is deprecated)
    */

    }
};}


g++ is required explicit qualifier "Pv::Derived<Tobj>::" for all
members of base class. We must do like this:
     return ( ptr && Pv::Derived<Tobj>::is_ok() )? 1: 0;

This is absolutely wrong, all non-private methods, declared in public
base classes, (and which have not hidden by derived declaraions) must
be visible in derived by defaults, without any explicit cast.

It is in general ancient error of g++, which is always very harry to
compile virtual members, but we must not have any differences betwen
the same members, depended only on "virtual" keyword in templates.

For example, in djgpp(g++) version 2.95, any "virtual" member with body
defined in place of declaration (in class description) of a template<T>
class  was not able to use dynamic_cast<T>, due to g++ tried to compile
the member befor T was declared and the same member with the keyword
commented (/* virtual */ ) worked fine.

Is it bug or no? Must i post the bug to?

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to