Topic: Does the text of 14.6.2 =?ISO-8859-1?Q?=A73_contradict_t?=
Author: stephen.clamage@sun.com (Steve Clamage)
Date: Fri, 18 Aug 2006 21:42:11 GMT Raw View
Ian Collins wrote:
> The text of sub-clause 14.6.2 =A73 states that "if a base class of this
> template depends on a template-parameter, the base class scope is not
> examined during name lookup until the class template is instantiated."
The 1998 version of the standard says that, which makes the example a lit=
tle=20
confusing. The 2003 update says "... the base class scope is not examined=
during=20
unqualified name lookup either at the point of definition of the class te=
mplate=20
or member or during an instantiation of the class template or member."
>=20
> But the example clearly states that in the following:
>=20
> #include <iostream>
>=20
> typedef double A;
>=20
> template <typename T> struct B {
> typedef T A;
> };
>=20
> template <typename T> struct D : B<T> {
> static const A a;
> };
>=20
> int main() {
> D<char> d;
> std::cout << sizeof d.a << std::endl;
> }
>=20
> A::a will be double.
>=20
> I tried this with gcc and Sun CC, with gcc sizeof d.a is 8 (double) and
> with CC it is 1 (char).
>=20
> Which is correct?
Sun CC is wrong according to the 2003 update. I have filed bug 6461746 fo=
r you.
Steve Clamage
Sun C++ Compiler Team
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: ian-news@hotmail.com (Ian Collins)
Date: Sun, 20 Aug 2006 17:35:24 GMT Raw View
Steve Clamage wrote:
> Ian Collins wrote:
>=20
>> The text of sub-clause 14.6.2 =A73 states that "if a base class of thi=
s
>> template depends on a template-parameter, the base class scope is not
>> examined during name lookup until the class template is instantiated."
>=20
>=20
> The 1998 version of the standard says that, which makes the example a
> little confusing. The 2003 update says "... the base class scope is not
> examined during unqualified name lookup either at the point of
> definition of the class template or member or during an instantiation o=
f
> the class template or member."
>=20
Thanks for the clarification, I realy should update my copy of the standa=
rd!
>>
>=20
> Sun CC is wrong according to the 2003 update. I have filed bug 6461746
> for you.
>=20
Thanks.
--=20
Ian Collins.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]