Bug 28371 - pointer to function type mistaken when template functions are involved
Summary: pointer to function type mistaken when template functions are involved
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: 3.3.3
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-13 15:45 UTC by Joaquín M López Muñoz
Modified: 2006-07-13 15:51 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.