[Bug c++/31323] New: typename A::B * p; in template definition, with curiously recurring template inheritance

2007-03-22 Thread mesti_mudam at yahoo dot com
The following code doesnt compile with gcc, dmc, icc. Im not sure if its
correct code, but it looks like it is.

#include 
using std::cout;
using std::endl;

template 
class Base
{
protected:
typename T::privIC * priv;
public:
virtual int f1() =0;
virtual int f2() =0;
};

class A : public Base
{
public:
class privIC
{
int i;
};
int f1();
int f2();
};

int A::f1()
{
return 0;
}

int A::f2()
{
return 0;
}

int main()
{
A a;
cout << a.f2() << endl;
}


-- 
   Summary: typename A::B * p; in template definition, with
curiously recurring template inheritance
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mesti_mudam at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31323



[Bug c++/31323] typename A::B * p; in template definition, with curiously recurring template inheritance

2007-03-22 Thread mesti_mudam at yahoo dot com


--- Comment #2 from mesti_mudam at yahoo dot com  2007-03-23 06:42 ---
well, priv is a pointer..


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31323



[Bug c++/31323] typename A::B * p; in template definition, with curiously recurring template inheritance

2007-03-26 Thread mesti_mudam at yahoo dot com


--- Comment #4 from mesti_mudam at yahoo dot com  2007-03-26 21:49 ---
ive no idea which part of the standard should imply/allow this. if one replaces
"typename T::privIC * priv" with "T * priv", its valid and it compiles. I
thought T::privC is equally accessible & 'incomplete' as T itself when
instantiating the template. what i want is:
class A : public Base
class B : public Base
etc.
all having the same interface, and all of them's private implementation class
is called privC. so either in A, B, etc. or later i'll define class A::privC,
class B::privC, etc.

maybe we should add this to the standard :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31323