You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typedeffloat float3 __attribute__((ext_vector_type(3)));
typedefstruct {
float3 b;
} struct_float3;
float3 foo(float3 a, const struct_float3* hi) {
return__builtin_elementwise_fma(a, a, hi->b.yyy);
}
float3 bar(float3 a, const struct_float3* hi) {
return__builtin_elementwise_pow(a, hi->b.yyy);
}
Clang will report an error about foo but not bar:
source.cpp:19:36: error: arguments are of different types ('float3' (vector of 3 'float' values) vs 'const float3' (vector of 3 'float' values))
19 | return __builtin_elementwise_fma(a, a, hi->b.yyy);
| ^
The solution is to use ASTContext::hasSameUnqualifiedType() in BuiltinElementwiseTernaryMath similar to #141397. This was originally discovered by @tbaederr in #153572 (comment).