This fixes an assertion in Sema::CreateBuiltinBinOp that fails when one
of the vector operand's element type is a typedef of __fp16.
rdar://problem/
55983556
/// type ElementType.
static bool isVector(QualType QT, QualType ElementType) {
if (const VectorType *VT = QT->getAs<VectorType>())
- return VT->getElementType() == ElementType;
+ return VT->getElementType().getCanonicalType() == ElementType;
return false;
}
typedef float float4 __attribute__ ((vector_size (16)));
typedef short short4 __attribute__ ((vector_size (8)));
typedef int int4 __attribute__ ((vector_size (16)));
+typedef __fp16 float16_t;
half4 hv0, hv1;
float4 fv0, fv1;
hv0++; // expected-error{{cannot increment value of type}}
++hv0; // expected-error{{cannot increment value of type}}
}
+
+void testTypeDef() {
+ __fp16 t0 __attribute__((vector_size (8)));
+ float16_t t1 __attribute__((vector_size (8)));
+ t1 = t0;
+}