Quantcast
Channel:
Viewing all articles
Browse latest Browse all 59170

Forum Post: RX Compiler - Parameter-Check at template methodes

$
0
0
Hello, I have a problem with template type parameter checks of the Renesas RX Compiler (V 2_4_1). It looks like the compiler didn't check the type. The source bellow instantiates a template class with type "unsigned char". The method Foo should also expect a parameter with type unsigned char. If I will generate a class object from type MyTemplate unsigned char and then call the method Foo with a parameter of wrong type (e.g. unsigned short) the compiler didn't generate a warning or an error. It accepts the type mismatch and truncates the value without any comments. template typename T class MyTemplateClass {     public:     void Foo(T param)     {         //do something with param     } }; void main(void) {     MyTemplateClass unsigned char instance;     unsigned short myParam = 0x1234;     //Compiler should generate an error or at least a "integer truncation"-warning here     instance.Foo(myParam);     while(1); } Is this a known toolchain problem? Best regards Juergen

Viewing all articles
Browse latest Browse all 59170

Trending Articles