aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/Sema.h2
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/CodeGen/2008-08-19-cast-of-typedef.c10
3 files changed, 12 insertions, 2 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index ed01085897..4bb54824fe 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -871,7 +871,7 @@ private:
bool CheckStringLiteralInit(StringLiteral *strLiteral, QualType &DeclT);
/// CheckCastTypes - Check type constraints for casting between types.
- bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *CastExpr);
+ bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *&CastExpr);
// CheckVectorCast - check type constraints for vectors.
// Since vectors are an extension, there are no C standard reference for this.
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index cac103a044..4781ffb578 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1089,7 +1089,7 @@ ActOnInitList(SourceLocation LBraceLoc, ExprTy **initlist, unsigned NumInit,
}
/// CheckCastTypes - Check type constraints for casting between types.
-bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *castExpr) {
+bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr) {
UsualUnaryConversions(castExpr);
// C99 6.5.4p2: the cast type needs to be void or scalar and the expression
diff --git a/test/CodeGen/2008-08-19-cast-of-typedef.c b/test/CodeGen/2008-08-19-cast-of-typedef.c
new file mode 100644
index 0000000000..581c79356b
--- /dev/null
+++ b/test/CodeGen/2008-08-19-cast-of-typedef.c
@@ -0,0 +1,10 @@
+// RUN: clang --emit-llvm -o %t %s
+
+typedef short T[4];
+struct s {
+ T f0;
+};
+
+void foo(struct s *x) {
+ bar((long) x->f0);
+}