 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Daniel Krügler Guest
|
Posted: Thu Apr 19, 2007 12:42 am Post subject: Defect report|editorial: Unwanted error in 14.8.2.5/12 examp |
|
|
Hello,
both the current 14882-2003 standard as well as the draft N2134
provide the following example in 14.8.2.4/12 and 14.8.2.5/12, resp.
template<class T, T i> void f(double a[10][i]);
int v[10][20];
f(v); //error: argument for template-parameter T cannot be deduced
The problem is that additional to the error which is explained here
there exists another one, namely that f has a parameter that is an
array of double, but the invocation provides an array of int.
Proposed resolution:
Fix the mentioned example as follows:
template<class T, T i> void f(int a[10][i]);
int v[10][20];
f(v); //error: argument for template-parameter T cannot be deduced
P.S.: I could not decide whether this is only editorial or not.
Greetings from Bremen,
Daniel Krügler
---
[ 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 ] |
|
| Back to top |
|
 |
Pete Becker Guest
|
Posted: Thu Apr 19, 2007 6:07 pm Post subject: Re: Defect report|editorial: Unwanted error in 14.8.2.5/12 e |
|
|
Daniel Krügler wrote:
| Quote: | Hello,
both the current 14882-2003 standard as well as the draft N2134
provide the following example in 14.8.2.4/12 and 14.8.2.5/12, resp.
template<class T, T i> void f(double a[10][i]);
int v[10][20];
f(v); //error: argument for template-parameter T cannot be deduced
The problem is that additional to the error which is explained here
there exists another one, namely that f has a parameter that is an
array of double, but the invocation provides an array of int.
Proposed resolution:
Fix the mentioned example as follows:
template<class T, T i> void f(int a[10][i]);
int v[10][20];
f(v); //error: argument for template-parameter T cannot be deduced
P.S.: I could not decide whether this is only editorial or not.
|
I can't decide either, which means that it's not editorial. <g>
--
-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
---
[ 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 ] |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|