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

2007-04-07 Thread bangerth at dealii dot org


--- Comment #5 from bangerth at dealii dot org  2007-04-08 00:54 ---
(In reply to comment #4)
 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.

Yes, but the difference is that we know what T is (and that it exists)
because it was given as a template argument. We don't know this about
T::privIC -- it may not exist for certain types given as T, but we can't
know without looking into T, which we can't because T isn't complete.

I am confident that the code isn't valid because at the point of use
T::privIC hasn't been declared yet. Since in addition none of the other
compilers you cite support this idiom, I'll close this PR.

W.


-- 

bangerth at dealii dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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 bangerth at dealii dot org


--- Comment #3 from bangerth at dealii dot org  2007-03-26 20:46 ---
(In reply to comment #2)
 well, priv is a pointer..

What I really meant was a typedef:

template class T struct Base {
typedef typename T::X X;
};

struct A : BaseA
{
typedef int X;
};


But still, what part of the standard makes you think that this should be
valid code?

W.


-- 


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 BaseA
class B : public BaseB
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



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

2007-03-22 Thread bangerth at dealii dot org


--- Comment #1 from bangerth at dealii dot org  2007-03-23 06:26 ---
Or smaller like this:
--
template class T struct Base {
typename T::X X;
};

struct A : BaseA
{
typedef int X;
};
--

sunCC also rejects it. I tend to believe that the code is invalid because
at the time where we instantiate BaseA (in the base class list of A), A 
is not complete and so the inner typedef is not available yet.

What makes you think that the code should compile?

W.


-- 

bangerth at dealii dot org changed:

   What|Removed |Added

 CC||bangerth at dealii dot org


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