Article View: comp.std.c++
Article #3967cv-quals in template arguments
From: 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 ]
Technical Details
Message-ID:
<WALD.96Apr9105559@woodpecker.lcs.mit.edu>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: wald@theory.lcs.mit.edu (David Wald) Newsgroups: comp.std.c++ Subject: cv-quals in template arguments Date: 9 Apr 1996 14:53:50 GMT Organization: Theory of Computation, LCS, MIT Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <WALD.96Apr9105559@woodpecker.lcs.mit.edu> NNTP-Posting-Host: taumet.eng.sun.com X-Nntp-Posting-Host: woodpecker.lcs.mit.edu Content-Length: 841 X-Lines: 24 Originator: clamage@taumet