Topic: Defect Report: address of function template specialization with explicit template argument list


Author: Nikolas Kauer <kauer@pheno.physics.wisc.edu>
Date: 11 Oct 00 03:46:47 GMT
Raw View
 [Moderator's note: this defect report has been
 forwarded to the C++ committee. -moderator(fjh).]

Section 13.4 [over.over] paragraph 2 regarding the address of
overloaded functions says that "[i]f the name is a function template,
template argument deduction is done (14.8.2.2), [...]"

Section 14.8.2.2 [temp.deduct.funcaddr] regarding the deduction of
template arguments when taking the address of a function template
prescribes deduction based on the function template's function type
and the type of the function pointer.

Now consider a case with a non-type template argument:

template<int i> void ftmpl(double x[]);

typedef void (*FPtr)(double x[]);

FPtr fptr = &ftmpl<3>;

It is unclear if this is a valid statement.

If I would not explicitly specify the template argument, implicit
template argument deduction would fail, since the function arguments
are the same for all template specializations.  But with explicitly
specified template argument the address is well-defined.  Hence, I
suggest it be valid and a clarification be added in section 13.4
[over.over] paragraph 2.

This submission may be related to C++ core language issue 115.


Sent via Deja.com http://www.deja.com/
Before you buy.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]