AnsweredAssumed Answered

using declaration problem with built-in functions

Question asked by tomschi on Sep 11, 2014
Latest reply on Sep 23, 2014 by tomschi

i have the following code that yields an compile-time error (using OpenCL compiler, AMD APP 1445.5 on Intel Core i7, using static C++ extensions):

 

namespace myNS

{

  using ::fmin;

}

 

void test()

{

  float f = myNS::fmin(1.0f, 2.0f);

}

 

results in

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

Error: "fmin" has already been declared in the current scope

 

"OpenCL-CPP-JIT-Source", line 9: error: a value of type "double16" cannot be

          used to initialize an entity of type "float"

    float f = myNS::fmin(1.0f, 2.0f);


i can get rid of the error if i insert the following declaration at the begin of the code snippet:


float fmin(float, float);


This is not specific to fmin, but i assume for all built-in, overloaded (?) functions (i've only tested a few: fabs, min, max...)

Why do i have to declare the built-in function in this case first?

Have i missed something or is this a compiler problem ?


thanks and regards,

  tomschi

Outcomes