Topic: cv-quals in template arguments
Author: wald@theory.lcs.mit.edu (David Wald)
Date: 1996/04/09 Raw View
What should a compiler do with the following code?
template <class T> T f(const T* p) {
return *p;
}
int foo(int* pi, const int* pci)
{
return f(pi) + f(pci);
}
Reading from the April'95 draft, it's clear that both calls to f
should resolve to f(const int*), as in the example in 14.10.2.14.
What's not clear to me is if both calls have the same return type. At
least one compiler around here complains that we've (implicitly)
provided two definitions of f(const int*), one returning int and one
returning const int. Can someone please quote me chapter and verse
on this?
-David
--
============================================================================
David Wald http://theory.lcs.mit.edu/~wald/ wald@theory.lcs.mit.edu
============================================================================
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]