Given some function

void ff(); // any signature

This function is callable:

void rcv_f( typename std::enable_if< true, decltype(ff) >::type const &f ) {}

This function template does not produce a candidate:

template< class F >
void rcv_f( typename std::enable_if< true, F >::type const &f ) {}

This function template prints two identical lines:

template< class F >
void rcv_f( F const &f ) {
    std::cerr << typeid( typename std::enable_if< true, F >::type ).name() <<
std::endl;
    std::cerr << typeid( F ).name() << std::endl;
}

The problem does not occur with functors. The first example still works if
trivially made into a template, so the dependent argument matters rather than
the dependent context.


-- 
           Summary: cannot match function ref argument to dependent
                    std::enable_if::type
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: potswa at mac dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44162

Reply via email to