Sanity fix for PR3642: if we're treating a diagnostic as an error, it's 
required to actually be an error for correctness.  The attached testcase 
now gives an error instead of mysteriously crashing.

Now, it's possible we actually want to support the given usage, but I 
haven't looked at the relevant code closely.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65253 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticSemaKinds.def b/include/clang/Basic/DiagnosticSemaKinds.def
index 7ebb5a7..fb9f363 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.def
+++ b/include/clang/Basic/DiagnosticSemaKinds.def
@@ -728,7 +728,7 @@
      "field %0 declared as a function")
 DIAG(err_field_incomplete, ERROR,
      "field has incomplete type %0")
-DIAG(err_variable_sized_type_in_struct, EXTENSION,
+DIAG(err_variable_sized_type_in_struct, ERROR,
      "variable sized type %0 must be at end of struct or class")
 DIAG(err_flexible_array_empty_struct, ERROR,
      "flexible array %0 not allowed in otherwise empty struct")
diff --git a/test/Sema/struct-decl.c b/test/Sema/struct-decl.c
index cdc9eaa..aa2d3b6 100644
--- a/test/Sema/struct-decl.c
+++ b/test/Sema/struct-decl.c
@@ -22,3 +22,14 @@
         struct st *f;
         return f->v + f[0].v;
 }
+
+// PR3642
+struct pppoe_tag {
+ short tag_type;
+ char tag_data[];
+};
+struct datatag {
+ struct pppoe_tag hdr; //expected-error{{variable sized type 'hdr' must be at end of struct}}
+ char data;
+};
+