diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 1 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 5f0908ae93..48860e027b 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -845,7 +845,8 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl, << (VD->getTLSKind() == VarDecl::TLS_Dynamic); return false; } - if (SemaRef.RequireLiteralType( + if (!VD->getType()->isDependentType() && + SemaRef.RequireLiteralType( VD->getLocation(), VD->getType(), diag::err_constexpr_local_var_non_literal_type, isa<CXXConstructorDecl>(Dcl))) @@ -1135,11 +1136,11 @@ bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) { // statement. We still do, unless the return type is void, because // otherwise if there's no return statement, the function cannot // be used in a core constant expression. + bool OK = getLangOpts().CPlusPlus1y && Dcl->getResultType()->isVoidType(); Diag(Dcl->getLocation(), - getLangOpts().CPlusPlus1y && Dcl->getResultType()->isVoidType() - ? diag::warn_cxx11_compat_constexpr_body_no_return - : diag::err_constexpr_body_no_return); - return false; + OK ? diag::warn_cxx11_compat_constexpr_body_no_return + : diag::err_constexpr_body_no_return); + return OK; } if (ReturnStmts.size() > 1) { Diag(ReturnStmts.back(), diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 0e513992ba..3c942fa40e 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -97,6 +97,7 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, DeclT = S.Context.getConstantArrayType(IAT->getElementType(), ConstVal, ArrayType::Normal, 0); + Str->setType(DeclT); return; } |