Created on 2001-07-11.00:00:00 last changed 207 months ago
[Moved to DR at October 2002 meeting.]
Proposed resolution (10/01, same as suggested resolution):
In the list of allowable forms for the types P and A in paragraph 9 of 13.10.3.6 [temp.deduct.type] replace
type(*)(T) T(*)() T(*)(T)
by
type(T) T() T(T)
Paragraph 9 of 13.10.3.6 [temp.deduct.type] enumerates the forms that the types P and A need to have in order for template argument deduction to succeed.
For P denoting a pointer to function the paragraph lists the following forms as allowing for template argument deduction:
type(*)(T) T(*)() T(*)(T)
On the other hand, no provision has been made to accommodate similar cases for references to functions, which in light of the wording of 13.10.3.6 [temp.deduct.type] paragraph 11 means that the program below is ill-formed (some of the C++ compilers do not reject it however):
    template<typename Arg, typename Result, typename T>
    Result  foo_r(Result(& rf)(Arg), T x)
    {   return  rf(Arg(x));   }
    template<typename Arg, typename Result, typename T>
    Result  foo_p(Result(* pf)(Arg), T x)
    {   return  pf(Arg(x));   }
    #include <iostream>
    int  show_arg(char c)
    {
       std::cout << c << ' ';
       if(std::cout)  return  0;
       return  -1;
    }
    int  main()
    {
                                                   // The deduction
       int  (& rf1)(int(&)(char), double) = foo_r; // shall fail here
                                                   // While here
       int  (& rf2)(int(*)(char), double) = foo_p; // it shall succeed
       return  rf2(show_arg, 2);
    }
		| History | |||
|---|---|---|---|
| Date | User | Action | Args | 
| 2008-10-05 00:00:00 | admin | set | status: wp -> cd1 | 
| 2003-04-25 00:00:00 | admin | set | status: dr -> wp | 
| 2002-11-08 00:00:00 | admin | set | messages: + msg782 | 
| 2002-11-08 00:00:00 | admin | set | status: ready -> dr | 
| 2002-05-10 00:00:00 | admin | set | status: review -> ready | 
| 2001-11-09 00:00:00 | admin | set | messages: + msg565 | 
| 2001-11-09 00:00:00 | admin | set | status: open -> review | 
| 2001-07-11 00:00:00 | admin | create | |