[cfe-dev] Clang: template functions
Paul Davey
plmdvy at gmail.com
Fri Nov 5 04:05:44 PDT 2010
On Fri, Nov 5, 2010 at 11:53 PM, Stefano S <kindoblue at gmail.com> wrote:
> Hi,
> For the first time I built llvm + clang on ubuntu box for giving it a try.
> I have this simple template function in a header file
> template <typename T, typename U>
> inline void SetMin(T &aVar,U aValue);
> but clang++ returns
> ../src/myfile.h:13:1: error: unknown type name 'template'
> template <typename T, typename U>
> ^
> ../src/myfile.h:13:10: error: expected identifier or '('
> template <typename T, typename U>
> I tried to use also -std=gnu89 because I've read gcc (which compiles my
> code) uses that standard by default, but with no success.
> I am using:
> clang version 2.9 (trunk 118246)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> Thanks
> Stefano
>
>
Just a question.
Are you trying to directly compile the header file?
I am not sure what clang++ will do with plain .h files...
try adding a -x c++ to the arguments.
More information about the cfe-dev
mailing list