diff options
author | Sam Weinig <sam.weinig@gmail.com> | 2010-02-01 05:02:49 +0000 |
---|---|---|
committer | Sam Weinig <sam.weinig@gmail.com> | 2010-02-01 05:02:49 +0000 |
commit | d17e340e2d516139931768697bf080f60920ba9d (patch) | |
tree | 04a49d3928c1e633c467a29ac01cd25a0aff9baa /lib/Sema/SemaChecking.cpp | |
parent | b13b737a2450167c82e148590e8019b839ce6b98 (diff) |
Fix for PR5185. C99 [*] VLA notation should be disallowed in function definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94972 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 1e7641690d..4e2e9c7376 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -2616,6 +2616,20 @@ bool Sema::CheckParmsForFunctionDef(FunctionDecl *FD) { !Param->isImplicit() && !getLangOptions().CPlusPlus) Diag(Param->getLocation(), diag::err_parameter_name_omitted); + + // C99 6.7.5.3p12: + // If the function declarator is not part of a definition of that + // function, parameters may have incomplete type and may use the [*] + // notation in their sequences of declarator specifiers to specify + // variable length array types. + QualType PType = Param->getOriginalType(); + if (const ArrayType *AT = Context.getAsArrayType(PType)) { + if (AT->getSizeModifier() == ArrayType::Star) { + // FIXME: This diagnosic should point the the '[*]' if source-location + // information is added for it. + Diag(Param->getLocation(), diag::err_array_star_in_function_definition); + } + } } return HasInvalidParm; |