> Hi all,
>
[quoted text clipped - 28 lines]
>
> Can anybody comment on this?
AFIAK there were no significant changes in the way VC handles template
instantiation in VC7.1 (or VC8).
-cd
> I was under impression that the ETI bug was completely fixed in VC71.
> However, recently I ran into a problem that makes me think otherwise.
> The following minimal example demonstrates the problem that looks very
> similar to ETI:
I think this a bit different from the nightmare in previous VC versions.
[..]
Specifically, I think VC doesn't realize that
> template <class T>
> struct X
> {
> typedef typename Y<sizeof(foo<T>())>::type type;
is a dependent name. I can't access my VC 7.1 installation right
now, but you could try to drop the typename and IIRC the
compiler won't complain. Or try to add a "+ 0 * sizeof(T)"
to make sure the compiler thinks it's a dependent name.
So the compiler see typedef Y<4>::type type;
in which case it's okay to instantiate Y<4>::type even if
X<T>::type is not instantiated.
So I think it's not exactly ETI. Nonetheless it's annoying
enough.
-hg
Arkadiy - 20 Mar 2005 04:59 GMT
> > I was under impression that the ETI bug was completely fixed in VC71.
> > However, recently I ran into a problem that makes me think otherwise.
[quoted text clipped - 15 lines]
> compiler won't complain. Or try to add a "+ 0 * sizeof(T)"
> to make sure the compiler thinks it's a dependent name.
Second one helps. Now I have to figure out whether it solves my
original problem or my minimal example was wrong.
> So the compiler see typedef Y<4>::type type;
> in which case it's okay to instantiate Y<4>::type even if
> X<T>::type is not instantiated.
>
> So I think it's not exactly ETI. Nonetheless it's annoying
> enough.
Thanks a lot.
Arkadiy
Arkadiy - 20 Mar 2005 05:00 GMT
> > I was under impression that the ETI bug was completely fixed in VC71.
> > However, recently I ran into a problem that makes me think otherwise.
[quoted text clipped - 15 lines]
> compiler won't complain. Or try to add a "+ 0 * sizeof(T)"
> to make sure the compiler thinks it's a dependent name.
Second one helps. Now I have to figure out whether it solves my
original problem or my minimal example was wrong.
> So the compiler see typedef Y<4>::type type;
> in which case it's okay to instantiate Y<4>::type even if
> X<T>::type is not instantiated.
>
> So I think it's not exactly ETI. Nonetheless it's annoying
> enough.
Thanks a lot.
Arkadiy
Arkadiy - 20 Mar 2005 05:26 GMT
> "Arkadiy" <vertleyb@hotmail.com> wrote
> Specifically, I think VC doesn't realize that
[quoted text clipped - 12 lines]
> in which case it's okay to instantiate Y<4>::type even if
> X<T>::type is not instantiated.
As I mentioned before, adding "+ 0 * sizeof(T)" makes the code compile.
However, if you take my original code and just replace 4 with any
other number, it also compiles. If this was a problem of the compiler
not recognizing a dependent name, the exact number used in the
specialization wouldn't matter, would it? But, since 4 is exactly
sizeof(int), this makes me to believe that the compiler tries to
temporaruly replace "T" with integer, as in ETI.
Regards,
Arkadiy
Holger Grund - 20 Mar 2005 15:36 GMT
"Arkadiy" <vertleyb@hotmail.com> wrote in message
>> Specifically, I think VC doesn't realize that
>>
[quoted text clipped - 19 lines]
> sizeof(int), this makes me to believe that the compiler tries to
> temporaruly replace "T" with integer, as in ETI.
That depends on how you put it ;-) If you consider
Y<sizeof(foo<T>())>::type a non-dependent name it should
be interpreted. But, oc, T is not known at this point in time
and probably substituted by an int.
It's IMHO a bit different from the VC 6 ETI issues where
it seemed that the compiler instantiated templates during
parsing. Oc, both things might be symptoms of the same
issue.
BTW: The code compiles fine with VC 8 beta.
-hg