[Bug c++/24139] Forward declaration of class in template class
redi at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Oct 1 14:52:00 GMT 2005
------- Additional Comments From redi at gcc dot gnu dot org 2005-10-01 14:52 -------
This is a revised version, which should compile but doesn't:
#include <iostream>
using namespace std;
template<typename T>
class Hide {
public:
Hide();
class Hidden;
private:
Hidden *a;
};
template<>
class Hide<int>::Hidden
{
public:
Hidden();
};
template<>
Hide<int>::Hide() {
a=new Hidden();
}
// N.B. no "template<>"
Hide<int>::Hidden::Hidden() {
cout << "Hello from int->Hidden" << endl;
}
int main(int argc,char *argv[])
{
Hide<int> b;
}
pr24139.2.cc:28: error: explicit specialization of
ÂHide<int>::Hidden<int>::Hidden()Â must be introduced by Âtemplate <>Â
pr24139.2.cc:28: error: template-id ÂHidden<>Â for
ÂHide<int>::Hidden<int>::Hidden()Â does not match any template declaration
pr24139.2.cc:28: error: invalid function declaration
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24139
More information about the Gcc-bugs
mailing list