Modify a diagnostic introduced in r132612 to emit QualTypes directly

This fixes a memory error on FreeBSD (and is the right thing to do
in any case).

llvm-svn: 132750
This commit is contained in:
Peter Collingbourne 2011-06-08 15:15:17 +00:00
parent eabd18b931
commit 23f1bee3c0
2 changed files with 4 additions and 4 deletions

View File

@ -5009,8 +5009,8 @@ ExprResult Sema::ActOnAsTypeExpr(Expr *expr, ParsedType destty,
if (Context.getTypeSize(DstTy) != Context.getTypeSize(SrcTy)) if (Context.getTypeSize(DstTy) != Context.getTypeSize(SrcTy))
return ExprError(Diag(BuiltinLoc, return ExprError(Diag(BuiltinLoc,
diag::err_invalid_astype_of_different_size) diag::err_invalid_astype_of_different_size)
<< DstTy.getAsString().c_str() << DstTy
<< SrcTy.getAsString().c_str() << SrcTy
<< expr->getSourceRange()); << expr->getSourceRange());
return Owned(new (Context) AsTypeExpr(expr, DstTy, VK, OK, BuiltinLoc, RParenLoc)); return Owned(new (Context) AsTypeExpr(expr, DstTy, VK, OK, BuiltinLoc, RParenLoc));
} }

View File

@ -11,10 +11,10 @@ void test_astype() {
typedef __attribute__(( ext_vector_type(4) )) double double4; typedef __attribute__(( ext_vector_type(4) )) double double4;
float4 f4; float4 f4;
double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of double4 and float4 must match}} double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' and 'float4' must match}}
// Verify int4->float3, float3->int4 works. // Verify int4->float3, float3->int4 works.
int4 i4; int4 i4;
float3 f3 = __builtin_astype(i4, float3); float3 f3 = __builtin_astype(i4, float3);
i4 = __builtin_astype(f3, int4); i4 = __builtin_astype(f3, int4);
} }