From 9da2a799abd809770efab64555321c01987cd591 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 23 Apr 2014 17:44:58 +0000 Subject: Objective-C [IRGen]. Fixes a crash in IRGen involving use of 'typeof' to extract type of an @encode expression used in an initializer. // rdar://16655340 llvm-svn: 207004 --- clang/lib/CodeGen/CGExprConstant.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CGExprConstant.cpp') diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index bce0475cbc0..4e615922fe2 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -836,7 +836,10 @@ public: // as an inline array. std::string Str; CGM.getContext().getObjCEncodingForType(E->getEncodedType(), Str); - const ConstantArrayType *CAT = cast(E->getType()); + QualType T = E->getType(); + if (T->getTypeClass() == Type::TypeOfExpr) + T = cast(T)->getUnderlyingExpr()->getType(); + const ConstantArrayType *CAT = cast(T); // Resize the string to the right size, adding zeros at the end, or // truncating as needed. -- cgit v1.2.3