This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16709] templated public inheritance fails to compile.
- From: "alex dot vanic at pgs dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jul 2004 05:40:24 -0000
- Subject: [Bug c++/16709] templated public inheritance fails to compile.
- References: <20040726065915.16709.alex.vanic@pgs.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From alex dot vanic at pgs dot com 2004-07-27 05:40 -------
Subject: Re: templated public inheritance fails to compile.
A total surprise to me! Sorry about wasting your time, thanks for the
education. I guess we'll fix up our code now.
Regards,
Alex Vanic
pinskia at gcc dot gnu dot org wrote:
>------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-26 13:26 -------
>Read <http://gcc.gnu.org/gcc-3.4/changes.html>:
>n a template definition, unqualified names will no longer find members of a dependent base. For
>example,
> template <typename T> struct B {
> int m;
> int n;
> int f ();
> int g ();
> };
> int n;
> int g ();
> template <typename T> struct C : B<T> {
> void g ()
> {
> m = 0; // error
> f (); // error
> n = 0; // ::n is modified
> g (); // ::g is called
> }
> };
>You must make the names dependent by prefixing them with this-> . Here is the corrected definition
>of C<T>::g ,
>
> template <typename T> void C<T>::g ()
> {
> this->m = 0;
> this->f ();
> this->n = 0
> this->g ();
> }
>
>
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16709