This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Strange compilier's behaviour with function template, NAN and default parameter

I have got an error message with next code

template< typename Type >
int func( Type as, float fl=NAN );
error:  #109: expression preceding parentheses of apparent call must have (pointer-to-) function type

It seems the problem is with resolving NAN, defined in math.h at line 249

#   define NAN (__ESCAPE__(0f_7FC00000))

There is no problem if no NAN used

template< typename Type >
int func( Type as, float fl=0 );

There is no problem if template not used

int func( int as, float fl=NAN );

There is no problem with GCC.

Compilier version

*** Using Compiler 'V5.05 update 2 (build 169)'

Parents
  • So, does anybody have bright idea and better solution than

    The only actual solution to this is for Keil/ARM to find.

    It's ARM's own header file, and ARM's own compiler, so if combining the two in a slightly unusual fashion causes a problem, that's ARM's problem to solve. So have you filed a support request yet?

    Until then, your best bet at a temporary workaround would probably be one of those you showed.

Reply
  • So, does anybody have bright idea and better solution than

    The only actual solution to this is for Keil/ARM to find.

    It's ARM's own header file, and ARM's own compiler, so if combining the two in a slightly unusual fashion causes a problem, that's ARM's problem to solve. So have you filed a support request yet?

    Until then, your best bet at a temporary workaround would probably be one of those you showed.

Children