Re: Compiler error using 4.5.2 with function template

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
  }






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux