diff --git a/lib/compress.js b/lib/compress.js
index 6144b6cdfe5..157511c9b25 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1720,10 +1720,10 @@ Compressor.prototype.compress = function(node) {
     }
 
     function find_scope(compressor) {
-        var level = 0, node;
-        while (node = compressor.parent(level++)) {
+        var level = 0, node = compressor.self();
+        do {
             if (node.variables) return node;
-        }
+        } while (node = compressor.parent(level++));
     }
 
     function find_try(compressor, level, node, scope, may_throw, sync) {
@@ -6733,6 +6733,7 @@ Compressor.prototype.compress = function(node) {
                 var refs = references[def.id];
                 if (!refs) return;
                 if (refs.start.block !== seg.block) return references[def.id] = false;
+                sym.scope = find_scope(tw);
                 refs.push(sym);
                 refs.end = seg;
                 if (def.id in prev) {
@@ -6747,6 +6748,7 @@ Compressor.prototype.compress = function(node) {
                 return references[def.id] = false;
             } else {
                 var refs = declarations.get(def.id) || [];
+                sym.scope = find_scope(tw);
                 refs.push(sym);
                 references[def.id] = refs;
                 if (!read) {
diff --git a/test/compress/const.js b/test/compress/const.js
index f275ef5cba3..1ab63894e8a 100644
--- a/test/compress/const.js
+++ b/test/compress/const.js
@@ -2144,3 +2144,28 @@ issue_5591: {
     ]
     node_version: ">=4"
 }
+
+issue_5656: {
+    options = {
+        collapse_vars: true,
+        merge_vars: true,
+    }
+    input: {
+        console.log(function(a) {
+            var b = a;
+            b++;
+            {
+                const a = b;
+            }
+        }());
+    }
+    expect: {
+        console.log(function(a) {
+            var b = a;
+            {
+                const a = ++b;
+            }
+        }());
+    }
+    expect_stdout: true
+}