New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attribute vector_size doesn't allow value dependent expressions in templates #17360
Comments
We should generalize the handling of dependent expressions from the alignment attributes to deal with this case too. |
I hit the same issue. typedef double attribute( ( vector_size( 64 ) ) ) float64x8_v0_t; template<typename T, int N> test.cc:13:30: error: 'vector_size' attribute requires an integer constant Any updates? |
Richard, as far as I know, alignment attributes only appertain to variables or typedefs (which both have AST nodes). I don't think we can generalize this approach for vector_size attribute as it appertains to types (which do not have AST nodes). |
This seems to be fixed on 7.0 ? I can still reproduce the issue with both versions above on a clang 6.0.0 from a Ubuntu 18.04.2 but I don't have this issue anymore on a clang 7.0.1 from an up to date ArchLinux. |
And as a workaround on older version. The solution from https://stackoverflow.com/a/48377726/904262 seems to work if you can use a typedef. The resulting vector type seems to have the correct layout and C++ name mangling so I assume it's the correct type... |
*** This bug has been marked as a duplicate of bug #16102 *** |
Extended Description
template
union point
{
T vec attribute((vector_size((sizeof(T)<<1))));
struct { T x,y; };
};
error: 'vector_size' attribute requires an integer constant
T vec attribute((vector_size((sizeof(T)<<1))));
^ ~~~~~~~~~~~~~~
The text was updated successfully, but these errors were encountered: