This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
GCC 2.95.2, Next 3.3; to parent class causes error in pickingspecialization
- To: gcc-bugs at gcc dot gnu dot org
- Subject: GCC 2.95.2, Next 3.3; to parent class causes error in pickingspecialization
- From: James McKelvey <mckelvey at fafnir dot com>
- Date: Sun, 23 Jan 2000 13:09:43 -0800
- Reply-To: mckelvey at fafnir dot com
GCC 2.95.2
Next Cube running NextSTEP 4.2, 3.3 Developer
Enclosed program demonstrates that a reference to a subclass does not match
an explicit specialization of a reference to the parent class:
g++ -o x x.cc
#include <iostream>
class Top
{
};
class X : public Top
{
public:
X(void)
{
};
};
class A
{
public:
A(Top& x); /* X& */
template <class T>
A(const T x);
};
template <class T>
A::
A(const T)
{
cout << "General constructor" << endl;
}
A::
A(Top&) /* X& */
{
cout << "Specialized constructor" << endl;
}
int main(void)
{
X i;
A b(i);
return 0;
}
Prints "General constructor". Changing Top& to X& makes it print
"Specialized constructor".
---
Where diesel guitars from faraway bars, blast out the
best songs from our holy wars. Coyote carnival catches
on fire, all the cops in the world pick us up on radar.
Jim McKelvey mckelvey@fafnir.com