????????1,?????????
The following test test.br, no problem running up entirely;
#include<stdio.h>
#include "common.h"
#include "Timer.h"
typedef struct PairRec
{
float first;
float second;
} Para;
kernel void struct_input(Para p[][], out Para result<>
{
float2 index;
index=indexof(result).xy;
result.first = p[index].first;
result.second = p[index].second;
}
int main(int argc, char** argv)
{
Para para_data[3][4];
Para para_result[3][4];
Para para_data_stream<3,4>;
Para para_result_stream<3,4>;
streamRead( para_data_stream, para_data);
struct_input(para_data_stream, para_result_stream);
streamWrite(para_result_stream, para_result);
}
However, when change the "first" inside the struct as capital letters "T", that is, following test2.br :
#include<stdio.h>
#include "common.h"
#include "Timer.h"
typedef struct PairRec
{
float T;
float second;
} Para;
kernel void struct_input(Para p[][], out Para result<>
{
float2 index;
index=indexof(result).xy;
result.T = p[index].T;
result.second = p[index].second;
}
int main(int argc, char** argv)
{
Para para_data[3][4];
Para para_result[3][4];
Para para_data_stream<3,4>;
Para para_result_stream<3,4>;
streamRead( para_data_stream, para_data);
struct_input(para_data_stream, para_result_stream);
streamWrite(para_result_stream, para_result);
}
Now The problem came out, the compiler does not recognize the "PairRec" type, error!
In my opinion , because of letters like "T" is actually a reserved word in the compiler,and the word "T" within the code test2.br have a name conflict with the definition of a template the head file brt.hpp (1172)(see below)
template <class T> class Addressable: public T
{
public:
mutable void *address;
template <typename U>Addressable(U* Address)
: T(Address->castToArg(T()))
{
this->address=Address;
}
// Addressable(const T &t, void * Address):T(t){this->address=Address;}
Addressable(const T&t):T(t){address=NULL;}
Addressable(const Addressable<T>& b):T(b){
this->address=b.address;
}
Addressable<T>&operator = (const T&b)
{
*static_cast<T*>(this)=static_cast<const T&>(b);
return *this;
}
Addressable<T>& operator = (const Addressable<T>& b)
{
*static_cast<T*>(this)=static_cast<const T&>(b);
if (address==NULL) this->address=b.address;
return *this;
}
};
Alas, this BUG kill me, a toss about such a long time!