1. bash-2.05b$ gcc -v
Reading specs from /usr/lib/gcc/i486-pc-linux-gnu/3.4.3/specs
Configured with: /var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/configure
--enable-version-specific-runtime-libs --prefix=/usr
--bindir=/usr/i486-pc-linux-gnu/gcc-bin/3.4.3
--includedir=/usr/lib/gcc/i486-pc-linux-gnu/3.4.3/include
--datadir=/usr/share/gcc-data/i486-pc-linux-gnu/3.4.3
--mandir=/usr/share/gcc-data/i486-pc-linux-gnu/3.4.3/man
--infodir=/usr/share/gcc-data/i486-pc-linux-gnu/3.4.3/info
--with-gxx-include-dir=/usr/lib/gcc/i486-pc-linux-gnu/3.4.3/include/g
++-v3 --host=i486-pc-linux-gnu --disable-altivec --enable-nls
--without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu
--with-system-zlib --disable-checking --disable-werror
--disable-libunwind-exceptions --enable-shared --enable-threads=posix
--disable-libgcj --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0,
pie-8.7.7)
2. source file (1.cc):
template <class T> class C1 {
public:
  C1() {}
  virtual ~C1() {}
protected:
  T* m_prop;
};

template <class T> class C2 : public C1<T> {
public:
  C2() {}
  void A() { m_prop = (T*)0; }
  virtual ~C2() {}
};

int main() {
  C2<int> a;
  return 0;
}

3. 1.ii
# 1 "1.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "1.cc"
template <class T> class C1 {
public:
  C1() {}
  virtual ~C1() {}
protected:
  T* m_prop;
};

template <class T> class C2 : public C1<T> {
public:
  C2() {}
  void A() { m_prop = (T*)0; }
  virtual ~C2() {}
};

int main() {
  C2<int> a;
  return 0;
}

4. compilation result:
bash-2.05b$ g++ --save-temps 1.cc 
1.cc: In member function `void C2<T>::A()':
1.cc:12: error: `m_prop' undeclared (first use this function)
1.cc:12: error: (Each undeclared identifier is reported only once for
each function it appears in.)

5. ??workaround?? if i use explicit scoping { C1<T>::m_prop = ... } all
is ok.

-- 
Кравченко Петр Геннадьевич
НПП "СпецСтрой Связь", НТЦ, разработчик
Тел. +7(8634)311562 доп 225
mailto: [EMAIL PROTECTED]

Attachment: signature.asc
Description: =?koi8-r?Q?=FC=D4=C1?= =?koi8-r?Q?_=DE=C1=D3=D4=D8?= =?koi8-r?Q?_=D3=CF=CF=C2=DD=C5=CE=C9=D1?= =?koi8-r?Q?_=D0=CF=C4=D0=C9=D3=C1=CE=C1?= =?koi8-r?Q?_=C3=C9=C6=D2=CF=D7=CF=CA?= =?koi8-r?Q?_=D0=CF=C4=D0=C9=D3=D8=C0?=

Reply via email to