From 583de921885932cc33c4b9d094d002aff8f70d62 Mon Sep 17 00:00:00 2001 From: BenceJanosSzabo <bence.janos.szabo@ericsson.com> Date: Wed, 22 Mar 2017 14:04:24 +0100 Subject: [PATCH] Reverted variable scope change: Do not use a reference to a variable after its scope ended Change-Id: I5fcead5492fc832ee679cbce341c6609508e0055 Signed-off-by: BenceJanosSzabo <bence.janos.szabo@ericsson.com> --- compiler2/CompilerError.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler2/CompilerError.cc b/compiler2/CompilerError.cc index 3f07868b7..da40be4ea 100644 --- a/compiler2/CompilerError.cc +++ b/compiler2/CompilerError.cc @@ -265,9 +265,10 @@ namespace Common { // borrow location information from the innermost context Location my_location; my_location.set_location( *(tail->location) ); - loc = &my_location; + my_location.print_location(stderr); + } else if (loc) { + loc->print_location(stderr); } - if (loc) loc->print_location(stderr); fputs("error: ", stderr); vfprintf(stderr, fmt, args); putc('\n', stderr); -- GitLab