aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-01 23:25:31 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-01 23:25:31 +0000
commit1be8aee8745e8b814ad2f151aa214b0ef07833db (patch)
tree2f43d734a9059a88a89ccd6e05ad80cf0ffc6568 /lib/Sema/SemaDecl.cpp
parentb289b3f324eb10d416b87080e39b315f6c17a695 (diff)
When the return type of a function is dependent, don't perform any
of the flow-control checks for falling off the end of a function, since the return type may instantiate to void. Similarly, if a return statement has an expression and the return type of the function is void, don't complain if the expression is type-dependent, since that type could instantiate to void. Fixes PR5071. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83222 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 37f8aed474..8e69caae5c 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1183,6 +1183,10 @@ void Sema::CheckFallThroughForFunctionDef(Decl *D, Stmt *Body) {
bool ReturnsVoid = false;
bool HasNoReturn = false;
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
+ // If the result type of the function is a dependent type, we don't know
+ // whether it will be void or not, so don't
+ if (FD->getResultType()->isDependentType())
+ return;
if (FD->getResultType()->isVoidType())
ReturnsVoid = true;
if (FD->hasAttr<NoReturnAttr>())
@@ -1202,7 +1206,7 @@ void Sema::CheckFallThroughForFunctionDef(Decl *D, Stmt *Body) {
&& (Diags.getDiagnosticLevel(diag::warn_suggest_noreturn_block)
== Diagnostic::Ignored || !ReturnsVoid))
return;
- // FIXME: Funtion try block
+ // FIXME: Function try block
if (CompoundStmt *Compound = dyn_cast<CompoundStmt>(Body)) {
switch (CheckFallThrough(Body)) {
case MaybeFallThrough: