This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34727] problem with templates and inheritence
- From: "isenbaev at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jan 2008 01:20:17 -0000
- Subject: [Bug c++/34727] problem with templates and inheritence
- References: <bug-34727-15603@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from isenbaev at gmail dot com 2008-01-10 01:20 -------
Sorry there was a missprint in a test code, here is a correct example:
template<class T>
class A
{
public:
T x;
};
template<class T>
class B : public A<T>
{
public:
void clear()
{
x = 0;
}
};
B<int> b;
int main()
{
b.x = 0;
b.clear();
return 0;
};
This fails with message
test.cpp: In member function `void B<T>::clear()':
test.cpp:14: error: `x' was not declared in this scope
Also, if we try to access b.x from outside, it works. That is, if we comment
the line "x = 0;" in clear function, it compiles.
If this code is wrong, please tell me why? Some other compilers compile this,
and some don't.
--
isenbaev at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34727