Short vectors are not generated in C++ header
- Dominant language
- C++
- Stars
- 3k
- Forks
- 352
- PR merge metrics
- No merged PRs in 30d
Description
In a very special case the short vectors are not generated in the C++ header file. If you use short vectors in a function prototype and this function proto is used in an exported struct, the generated header does not contain a definition for used short vectors. This leads to compile issues in the host code. Here is a minimal example to reproduce the issue:
```
struct MyStruct;
typedef void (*MyFunc)(varying float<2>&a, uniform int<2>& b);
struct MyStruct {
uniform MyFunc func;
int data;
};
export void my_struct_init(uniform MyStruct& my_struct) {
my_struct.func = NULL;
}
```
The function prototype generated in the C++ header is partially wrong.
```
#ifndef __ISPC_STRUCT_MyStruct__
#define __ISPC_STRUCT_MyStruct__
struct MyStruct {
void ( * func)(float2 &a, int32_t2 &b);
int32_t data;
};
#endif
```
**a** is a varying type and hence should be (with regard to the documentation) a pointer to float2. Further Ispc does not generate a definition for float2 which leads to compiler error: _syntax error: identifier 'float2'_
I use ISPC 1.5.0. I do not tested it with other versions.
Contributor guide
Assessment
This issue has not been assessed yet.