diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-05-26 20:46:24 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-05-26 20:46:24 +0000 |
commit | 2c0a54031c98721460806e78e0e10da093d3fd72 (patch) | |
tree | 8482ab15038cb698051941f6d42283ab87e4a6f3 | |
parent | 4142cebf70fe6c3855570c98b8042431797a65fd (diff) |
Improve on flexible array diagnostics (PR7029).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104739 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/flexible-array-test.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index a76757fc07..2ce66903d2 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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< diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index dac070aaae..6fe91905dc 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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; diff --git a/test/SemaCXX/flexible-array-test.cpp b/test/SemaCXX/flexible-array-test.cpp index e58992bc93..02e3f83974 100644 --- a/test/SemaCXX/flexible-array-test.cpp +++ b/test/SemaCXX/flexible-array-test.cpp @@ -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 []'}} }; |