]> granicus.if.org Git - clang/commitdiff
Improve on flexible array diagnostics (PR7029).
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 26 May 2010 20:46:24 +0000 (20:46 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 26 May 2010 20:46:24 +0000 (20:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104739 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDecl.cpp
test/SemaCXX/flexible-array-test.cpp

index a76757fc078b93cdc8ea0381b2dbd1cfa5e50de7..2ce66903d27543f63defe9709d92b4f5abb35104 100644 (file)
@@ -1829,7 +1829,7 @@ def ext_variable_sized_type_in_struct : ExtWarn<
 def err_flexible_array_empty_struct : Error<
   "flexible array %0 not allowed in otherwise empty struct">;
 def err_flexible_array_has_nonpod_type : Error<
-  "flexible array %0 must have a non-dependent, non-POD type">;
+  "flexible array member %0 of non-POD element type %1">;
 def ext_flexible_array_in_struct : Extension<
   "%0 may not be nested in a struct due to flexible array member">;
 def ext_flexible_array_in_array : Extension<
index dac070aaae804dcab8cb1ea4c8f6a1f8f4daf395..6fe91905dc5488fde06f81c484794f9487cc5ba7 100644 (file)
@@ -6139,7 +6139,7 @@ void Sema::ActOnFields(Scope* S,
       if (!FD->getType()->isDependentType() &&
           !Context.getBaseElementType(FD->getType())->isPODType()) {
         Diag(FD->getLocation(), diag::err_flexible_array_has_nonpod_type)
-        << FD->getDeclName();
+          << FD->getDeclName() << FD->getType();
         FD->setInvalidDecl();
         EnclosingDecl->setInvalidDecl();
         continue;
index e58992bc931435b61d4a922006427299dd984f0d..02e3f83974e2813d8bdd11774de54e8d3ab6c36c 100644 (file)
@@ -41,5 +41,5 @@ struct S {
 
 struct X {
    int blah;
-   S strings[];        // expected-error {{flexible array 'strings' must have a non-dependent, non-POD type}}
+   S strings[];        // expected-error {{flexible array member 'strings' of non-POD element type 'S []'}}
 };