Compiler error using 4.5.2 with function template
Edward Diener
eldlistmailingz@tropicsoft.com
Sat Mar 5 16:38:00 GMT 2011
On 3/5/2011 11:17 AM, Edward Diener wrote:
> This very simple program:
>
> template<class T> struct ATemplate { };
> template<class T> void check(ATemplate<&T::SomeFuncTemplate<int> > *);
>
> int main()
> {
> return 0;
> }
>
> produces a compiler error:
>
> "test_has_mem_fun_template.cpp:2:66: error: template argument 1 is invalid
>
> "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g
> -Wno-variadic-macros -I"..\..\.."
> -I"C:\Programming\VersionControl\boost" -c -o
> "..\..\..\bin.v2\libs\tti\test\test_has_mem_fun_template.test\gcc-mingw-4.5.2\debug\test_has_mem_fun_template.o"
> "test_has_mem_fun_template.cpp""
>
> I suspect that I need to add the 'template' keyword to tell the compiler
> that SomeFuncTemplate is a function template but all my attempts appear
> to fail.
>
> Is this a compiler bug or do I need to do something else above ?
Evidently this works:
template<class T> struct ATemplate { };
template<class T> void check(ATemplate<typename T::template
SomeFuncTemplate<int> > *);
int main()
{
return 0;
}
More information about the Gcc-help
mailing list