Re: gcc 3.4.5: Partially specialized descendant of template doesn't see members of base

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.
See my remarks with "///".
Regards,
Dima.

On 10/7/06, Mazay wrote:
template <class T>
class Der<T,4>: public Base<T>
{
public:
    using Base<T>::x; //!!
///   I think this is misuse of "using". "using" in a class scope is
intended for
/// disambigation in the case of multiple inheritance.

template <class T,int num>
int Der<T,num>::get()
{
    return x-num;
///   I don't know why compiler does not shout on this one, see below.

}

template <class T>
int Der<T,4>::get()
{
    return x+4; //38 row. The error is here. x is not declared in this scope.
///   It should be "this->x". Otherwise compiler should shout, because
of two pass
/// compilation of the templates, it cannot know what is "x".

}

Compilation output:
---------------------------------------------------------
C:\prg\test\mingw_templ>g++ main.cpp
main.cpp: In member function `int Der<T, 4>::get()':
main.cpp:38: error: `x' was not declared in this scope
---------------------------------------------------------

Compiler version information:
---------------------------------------------------------
C:\prg\test\mingw_templ>g++ -v
Reading specs from C:/Install/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux