------- 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

Reply via email to