commit 248d4be51443e4c1a6137f285bdde1a027120bb6
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Thu Aug 27 16:07:25 2015 +0200
Commit: Roberto E. Vargas Caballero <[email protected]>
CommitDate: Thu Aug 27 16:07:25 2015 +0200
Disallow sizeof of incomplete type
diff --git a/cc1/expr.c b/cc1/expr.c
index 107e075..233e003 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -961,6 +961,8 @@ unary(void)
case SIZEOF:
next();
tp = (yytoken == '(') ? sizeexp() : typeof(unary());
+ if (!tp->defined)
+ errorp("sizeof applied to an incomplete type");
return sizeofnode(tp);
case INC:
case DEC: