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>())
&& (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:
return StmtError();
if (FnRetType->isVoidType()) {
- if (RetValExp) {// C99 6.8.6.4p1 (ext_ since GCC warns)
+ if (RetValExp && !RetValExp->isTypeDependent()) {
+ // C99 6.8.6.4p1 (ext_ since GCC warns)
unsigned D = diag::ext_return_has_expr;
if (RetValExp->getType()->isVoidType())
D = diag::ext_return_has_void_expr;