From df8f73fd8ae0aff10e456ec7317f20c997b195ce Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 9 Apr 2015 19:53:25 +0000 Subject: [Sema] Diagnose references to unbound arrays in function definitions A [*] is only allowed in a declaration for a function, not in its definition. We didn't correctly recurse on reference types while looking for it, causing us to crash in CodeGen instead of rejecting it. llvm-svn: 234528 --- clang/lib/Sema/SemaChecking.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Sema/SemaChecking.cpp') diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index e557c50e027..d4390e53f0b 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -7713,6 +7713,10 @@ static void diagnoseArrayStarInParamType(Sema &S, QualType PType, diagnoseArrayStarInParamType(S, PointerTy->getPointeeType(), Loc); return; } + if (const auto *ReferenceTy = dyn_cast(PType)) { + diagnoseArrayStarInParamType(S, ReferenceTy->getPointeeType(), Loc); + return; + } if (const auto *ParenTy = dyn_cast(PType)) { diagnoseArrayStarInParamType(S, ParenTy->getInnerType(), Loc); return; -- cgit v1.2.3