summaryrefslogtreecommitdiff
path: root/gcc/cp/typeck.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/typeck.cc')
-rw-r--r--gcc/cp/typeck.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 53ac925a092..c225c4e2423 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -11236,9 +11236,6 @@ check_return_expr (tree retval, bool *no_warning)
build_zero_cst (TREE_TYPE (retval)));
}
- if (processing_template_decl)
- return saved_retval;
-
/* A naive attempt to reduce the number of -Wdangling-reference false
positives: if we know that this function can return a variable with
static storage duration rather than one of its parameters, suppress
@@ -11250,6 +11247,9 @@ check_return_expr (tree retval, bool *no_warning)
&& TREE_STATIC (bare_retval))
suppress_warning (current_function_decl, OPT_Wdangling_reference);
+ if (processing_template_decl)
+ return saved_retval;
+
/* Actually copy the value returned into the appropriate location. */
if (retval && retval != result)
{