This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31881] New: inherited members invisible within nested class within templated class
- From: "ghood at psc dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 May 2007 16:18:56 -0000
- Subject: [Bug c++/31881] New: inherited members invisible within nested class within templated class
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Here is the code (nest.cc) that exhibits the error:
template<class X>
class A
{
public:
class B
{
public:
int i;
};
class C: public B
{
public:
void f()
{
this->i; // OK
i; // results in "error: ?i? was not declared in this scope"
// even though i should be inherited from B
}
};
};
This code generate an error when compiled with "g++ -v -save-temps -c nest.cc"
on powerpc-linux-gnu using gcc 4.1.2, on i386-redhat-linux using gcc 4.1.0,
and on x86_64-redhat-linux using gcc 3.4.5. This is somehow related to the
classes being templated because removing the template<class X> line will
eliminate the error.
It compiles without problem on i386-redhat-linux using gcc 3.2.2, on
x86_64-redhat-linux using PGI's pgCC 6.1.6, and on x86_64-redhat-linux using
Intel's icc 9.1.
--
Summary: inherited members invisible within nested class within
templated class
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ghood at psc dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31881