This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/10133: public/protected member of template base class is not seen in derived template class.


>Number:         10133
>Category:       c++
>Synopsis:       public/protected member of template base class is not seen in derived template class.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 18 12:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Carlo Wood
>Release:        gcc version 3.4 20030313 (experimental)
>Organization:
>Environment:

>Description:
The following is a regression, it compiles with all
versions up till and including 3.3 (20030313).
I am not 100% sure it *should* compile.

> cat test.cc
template <int instance>
  struct B {
    int i;
  };

template <int instance>
  struct A : public B <instance> {
    void f() { int* p = &i; }
  };


> g++-cvs-3.4 -c test.cc
test.cc: In member function `void A<instance>::f()':
test.cc:8: error: `i' has not been declared
>How-To-Repeat:

>Fix:
Using '&B<instance>::i' instead of '&i' works.
Using '&this->i' also works.

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]