diff options
author | Matt Beaumont-Gay <matthewbg@google.com> | 2012-08-15 19:53:19 +0000 |
---|---|---|
committer | Matt Beaumont-Gay <matthewbg@google.com> | 2012-08-15 19:53:19 +0000 |
commit | 99570a58b09fca5d0b328733ab8b6717a1a04f4a (patch) | |
tree | 920477ad23c8fa4f798fb6135942015fa3536f72 | |
parent | a8ac203967adaa18c5cbf869e368f7103060be1a (diff) |
Allow 'static' and type qualifiers in K&R parameter type lists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161980 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaType.cpp | 3 | ||||
-rw-r--r-- | test/Sema/static-array.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 7b7cc99dff..54f8dbaf01 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -2263,7 +2263,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // shall appear only in a declaration of a function parameter with an // array type, ... if (ASM == ArrayType::Static || ATI.TypeQuals) { - if (!D.isPrototypeContext()) { + if (!(D.isPrototypeContext() || + D.getContext() == Declarator::KNRTypeListContext)) { S.Diag(DeclType.Loc, diag::err_array_static_outside_prototype) << (ASM == ArrayType::Static ? "'static'" : "type qualifier"); // Remove the 'static' and the type qualifiers. diff --git a/test/Sema/static-array.c b/test/Sema/static-array.c index be8957c254..5ca693b2bf 100644 --- a/test/Sema/static-array.c +++ b/test/Sema/static-array.c @@ -51,3 +51,7 @@ void n(int *(x)[static 10]); // no-warning void o(int (x[static 10])(void)); // expected-error{{'x' declared as array of functions of type 'int (void)'}} void p(int (^x)[static 10]); // expected-error{{block pointer to non-function type is invalid}} void q(int (^x[static 10])()); // no-warning + +void r(x) + int x[restrict]; // no-warning +{} |