diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-09 17:56:32 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-09 17:56:32 +0000 |
commit | 629833915219395cc5ab308680907a64360e0f9b (patch) | |
tree | f12f394846d5adb152f02632c0a0a1c532e5055d /gcc/cp/typeck.c | |
parent | 5b5b96cf3ab8cb11a536101a80a46e6dac736dba (diff) | |
download | ppe42-gcc-629833915219395cc5ab308680907a64360e0f9b.tar.gz ppe42-gcc-629833915219395cc5ab308680907a64360e0f9b.zip |
PR c++/57437
* typeck.c (check_return_expr): Lambda proxies aren't eligible
for nrv or return by move.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r-- | gcc/cp/typeck.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 462abdd5039..6f7d4892879 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8399,7 +8399,8 @@ check_return_expr (tree retval, bool *no_warning) && VAR_P (retval) && DECL_CONTEXT (retval) == current_function_decl && ! TREE_STATIC (retval) - && ! DECL_ANON_UNION_VAR_P (retval) + /* And not a lambda or anonymous union proxy. */ + && !DECL_HAS_VALUE_EXPR_P (retval) && (DECL_ALIGN (retval) <= DECL_ALIGN (result)) /* The cv-unqualified type of the returned value must be the same as the cv-unqualified return type of the @@ -8444,7 +8445,7 @@ check_return_expr (tree retval, bool *no_warning) Note that these conditions are similar to, but not as strict as, the conditions for the named return value optimization. */ if ((cxx_dialect != cxx98) - && (VAR_P (retval) + && ((VAR_P (retval) && !DECL_HAS_VALUE_EXPR_P (retval)) || TREE_CODE (retval) == PARM_DECL) && DECL_CONTEXT (retval) == current_function_decl && !TREE_STATIC (retval) |