diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-12-05 23:32:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-12-05 23:32:09 +0000 |
commit | 4619e439b64a251fe35f7a5821aa90d78b879fa9 (patch) | |
tree | d67783abf73134f163d2d6151c65b7bcb5cbc4ac /clang/lib/Sema/SemaStmt.cpp | |
parent | 0733759b5aaabd81eb2348651fb726c075c08e0c (diff) | |
download | bcm5719-llvm-4619e439b64a251fe35f7a5821aa90d78b879fa9.tar.gz bcm5719-llvm-4619e439b64a251fe35f7a5821aa90d78b879fa9.zip |
Introduce basic support for dependent types, type-dependent
expressions, and value-dependent expressions. This permits us to parse
some template definitions.
This is not a complete solution; we're missing type- and
value-dependent computations for most of the expression types, and
we're missing checks for dependent types and type-dependent
expressions throughout Sema.
llvm-svn: 60615
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 0159f5f0a53..21f897f639b 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -782,21 +782,23 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprTy *rex) { return new ReturnStmt(ReturnLoc, (Expr*)0); } - // we have a non-void function with an expression, continue checking - QualType RetValType = RetValExp->getType(); - - // C99 6.8.6.4p3(136): The return statement is not an assignment. The - // overlap restriction of subclause 6.5.16.1 does not apply to the case of - // function return. - - // In C++ the return statement is handled via a copy initialization. - // the C version of which boils down to - // CheckSingleAssignmentConstraints. - if (PerformCopyInitialization(RetValExp, FnRetType, "returning")) - return true; - - if (RetValExp) CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc); + if (!FnRetType->isDependentType() && !RetValExp->isTypeDependent()) { + // we have a non-void function with an expression, continue checking + QualType RetValType = RetValExp->getType(); + + // C99 6.8.6.4p3(136): The return statement is not an assignment. The + // overlap restriction of subclause 6.5.16.1 does not apply to the case of + // function return. + + // In C++ the return statement is handled via a copy initialization. + // the C version of which boils down to + // CheckSingleAssignmentConstraints. + if (PerformCopyInitialization(RetValExp, FnRetType, "returning")) + return true; + if (RetValExp) CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc); + } + return new ReturnStmt(ReturnLoc, (Expr*)RetValExp); } |