Topic: Does the text of 14.6.2 =?ISO-8859-1?Q?=A73_contradict_the_?=


Author: ian-news@hotmail.com (Ian Collins)
Date: Thu, 17 Aug 2006 12:39:42 GMT
Raw View
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."

Which implies to me that the base class scope is included in the name
lookup.

But the example clearly states that in the following:

#include <iostream>

typedef double A;

template <typename T> struct B {
  typedef T A;
};

template <typename T> struct D : B<T> {
  static const A a;
};

int main() {
  D<char> d;
  std::cout << sizeof d.a << std::endl;
}

A::a will be double.

I tried this with gcc and Sun CC, with gcc sizeof d.a is 8 (double) and
with CC it is 1 (char).

Which is correct?

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