Bug 28371

Summary: pointer to function type mistaken when template functions are involved
Product: gcc Reporter: Joaquín M López Muñoz <joaquin>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs
Priority: P3    
Version: 3.2   
Target Milestone: 3.3.3   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Joaquín M López Muñoz 2006-07-13 15:45:35 UTC
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
Comment 1 Richard Biener 2006-07-13 15:51:40 UTC
Fixed (at least) in 3.3.3.