[Bug c++/28371] New: pointer to function type mistaken when template functions are involved

joaquin at tid dot es gcc-bugzilla@gcc.gnu.org
Thu Jul 13 15:45:00 GMT 2006


The following snippet:

#include <iostream>

void foo(){}
template<typename T>void bar(){}

template<typename T>
void test(const T&)
{
  std::cout<<typeid(T).name()<<std::endl;
}

int main()
{
  test(&foo);
  test(&bar<int>);
}

produces this oputput on gcc version 3.2 20020927
(prerelease) under Cygwin:

PFvvE
FvvE

But the two lines should be identical --in both
cases, the deduced T should be void(*)().
Although it is not immediately apparent in
the testcase provided, what happens is that the
second type is taken as void(), i.e. the pointer
somehow is dropped.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


-- 
           Summary: pointer to function type mistaken when template
                    functions are involved
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joaquin at tid dot es


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



More information about the Gcc-bugs mailing list