Topic: typedef visibility / standard compliance
Author: stip@mathematik.uni-ulm.de (Alexander Stippler)
Date: Mon, 23 Jun 2003 18:28:19 +0000 (UTC) Raw View
Hello,
I already posted this problem on comp.lang.c++ since I thought I was wrong.
But perhaps the piece of code below is standard compliant. It compiles fine
with gcc 3.2 (up to 3.4), but it does not compile with Comeau C++.
"Inherited member not allowed". + "Identifier Index is undefined"
Here it is: Is it snandard compliant?
template <typename D>
class ConstMatrix
{
public:
typedef typename D::Index Index;
double
operator()(const Index &i) const { return 0.0; }
};
template <typename D>
class Matrix
: public ConstMatrix<D>
{
public:
typedef typename D::Index Index;
double
operator()(const Index &i);
using ConstMatrix<D>::operator();
};
template <typename D>
double
Matrix<D>::operator()(const Index &i) { return 0.0; }
class X
{
public:
typedef int Index;
};
int
main()
{
Matrix<X> m;
m(3);
}
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]