Thread View: comp.std.c++
1 messages
1 total messages
Started by David Wald
Tue, 09 Apr 1996 14:53
cv-quals in template arguments
Author: David Wald
Date: Tue, 09 Apr 1996 14:53
Date: Tue, 09 Apr 1996 14:53
31 lines
1751 bytes
1751 bytes
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 ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads