aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a4f686a..c37b4fe 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -14417,10 +14417,15 @@ fndecl_declared_return_type (tree fn)
{
fn = STRIP_TEMPLATE (fn);
if (FNDECL_USED_AUTO (fn))
- return (DECL_STRUCT_FUNCTION (fn)->language
- ->x_auto_return_pattern);
- else
- return TREE_TYPE (TREE_TYPE (fn));
+ {
+ struct language_function *f = NULL;
+ if (DECL_STRUCT_FUNCTION (fn))
+ f = DECL_STRUCT_FUNCTION (fn)->language;
+ if (f == NULL)
+ f = DECL_SAVED_FUNCTION_DATA (fn);
+ return f->x_auto_return_pattern;
+ }
+ return TREE_TYPE (TREE_TYPE (fn));
}
/* Returns true iff DECL was declared with an auto return type and it has