Compiler: gcc 4.0.2 (bug can exist in higher versions)
OS: Red Hat Linux Adv. Server
Code, that generate error:
//=================================================
#include <iostream>
template <typename F>
void MainFunction (F f)
{
}
template <typename Type>
void TestFunc (Type & t)
{
}
template <typename T1, typename T2>
void TestFunc (T1 & t1, T2 & t2)
{
}
int main ()
{
MainFunction(TestFunc<int>);
return 1;
}
//=================================================
gcc output:
**** Incremental build of configuration Debug for project test ****
make -k all
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -omain.o ../main.cpp
../main.cpp: In function int main():
../main.cpp:21: error: no matching function for call to MainFunction(<unknown
type>)
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project test
Error is that giving code is correct. Comeau and VS 7.1 compile it without any
problem.
--
Summary: Error while deducting template arg
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: suzev dot kirill at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28793