Index: src/tests/.expect/castError.txt
===================================================================
--- src/tests/.expect/castError.txt	(revision 0dc954bd83db8e34f0ec3ef5aa7213bf36083ab9)
+++ src/tests/.expect/castError.txt	(revision b1e68d0353f497191202b2ee47853c063104f360)
@@ -4,16 +4,4 @@
 ... to:
   charAlternatives are:
-Cost ( 1, 0, 0, 0 ): Cast of:
-     Variable Expression: f: function
-       accepting unspecified arguments
-     ... returning nothing 
-
-   ... to:
-     char
- (types:
-   char
- )
- Environment: 
-
 Cost ( 1, 0, 0, 0 ): Cast of:
      Variable Expression: f: signed int
@@ -34,3 +22,15 @@
  Environment: 
 
+Cost ( 1, 0, 0, 0 ): Cast of:
+     Variable Expression: f: function
+       accepting unspecified arguments
+     ... returning nothing 
 
+   ... to:
+     char
+ (types:
+   char
+ )
+ Environment: 
+
+
Index: src/tests/.expect/typedefRedef-ERR1.txt
===================================================================
--- src/tests/.expect/typedefRedef-ERR1.txt	(revision b1e68d0353f497191202b2ee47853c063104f360)
+++ src/tests/.expect/typedefRedef-ERR1.txt	(revision b1e68d0353f497191202b2ee47853c063104f360)
@@ -0,0 +1,2 @@
+typedefRedef.c:4:1 error: Cannot redefine typedef: Foo
+typedefRedef.c:60:1 error: Cannot redefine typedef: ARR
Index: src/tests/Makefile.am
===================================================================
--- src/tests/Makefile.am	(revision 0dc954bd83db8e34f0ec3ef5aa7213bf36083ab9)
+++ src/tests/Makefile.am	(revision b1e68d0353f497191202b2ee47853c063104f360)
@@ -138,2 +138,5 @@
 completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
 	${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
+
+typedefRedef-ERR1: typedefRedef.c @CFA_BINDIR@/@CFA_NAME@
+	${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
Index: src/tests/Makefile.in
===================================================================
--- src/tests/Makefile.in	(revision 0dc954bd83db8e34f0ec3ef5aa7213bf36083ab9)
+++ src/tests/Makefile.in	(revision b1e68d0353f497191202b2ee47853c063104f360)
@@ -892,4 +892,7 @@
 	${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
 
+typedefRedef-ERR1: typedefRedef.c @CFA_BINDIR@/@CFA_NAME@
+	${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
Index: src/tests/typedefRedef.c
===================================================================
--- src/tests/typedefRedef.c	(revision b1e68d0353f497191202b2ee47853c063104f360)
+++ src/tests/typedefRedef.c	(revision b1e68d0353f497191202b2ee47853c063104f360)
@@ -0,0 +1,69 @@
+typedef volatile struct Foo FooInterm;
+typedef const FooInterm Foo;
+#ifdef ERR1
+typedef struct Foo Foo;
+#endif
+
+typedef int ** pt;
+typedef int ** pt;
+
+#ifdef __CFA__
+extern "C" {
+#endif
+typedef int __io_read_fn ( char buf);
+typedef int __io_write_fn ( const char buf);
+
+
+__io_read_fn read;
+__io_write_fn write;
+#ifdef __CFA__
+}
+#endif
+
+int sz;
+typedef int FUNC(int, ...);
+typedef int FUNC(int, ...);
+
+typedef int ARR[];
+typedef int ARR[];
+// #ifdef ERR1
+// if a typedef has an array dimension,
+// it can only be redefined to the same dimension
+typedef int ARR[2];
+// #endif
+
+typedef int X;
+typedef int Y;
+typedef Y Y2;
+typedef X X2;
+
+typedef Y2 Z;
+typedef X2 Z;
+
+typedef Z X2;
+typedef int X2;
+typedef Z X2;
+typedef int X2;
+
+// xxx - this doesn't work yet due to parsing problems with generic types
+// #ifdef __CFA__
+// typedef forall(type T) void foo(T);
+// typedef forall(type T) void foo(T);
+// typedef forall(type S) void foo(S); // should be allowed to do this...
+// #endif
+
+int main() {
+  typedef int ARR[sz];
+
+  // can't redefine typedef which is VLA
+#if ERR1
+  typedef int ARR[sz];
+#endif
+
+  Foo *x;
+
+  typedef struct Bar Foo;
+  Foo *y;
+
+  typedef int *** pt;
+}
