<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Evaluating a variable shadowed inside a block gets ambiguity error since r247836"
href="https://llvm.org/bugs/show_bug.cgi?id=24995">24995</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Evaluating a variable shadowed inside a block gets ambiguity error since r247836
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dawn+bugzilla@burble.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>If an identifier is shadowed inside a block, evaluating the identifier gets an
ambiguity error. This started with lldb r247836. (Note: test case was tested
with clang based on svn 3.4, 3.6 and trunk on OSX).
Run to BPs as indicated in the test cases below and evaluate my_val. You get:
(lldb) p my_val
error: reference to 'my_val' is ambiguous
note: candidate found by name lookup is 'my_val'
note: candidate found by name lookup is 'my_val'
error: 1 errors parsing expression
Test case 1:
#include <stdio.h>
int make_used;
int main() {
static int my_val = 103;
{
static int my_val = 101;
make_used += my_val;
}
// Set BP1, eval my_val, Exp: 103 Act: ambiguous
printf("\neval @BP1 line=%d: my_val = %d", __LINE__, my_val);
return make_used == 0;
}
Test case 2:
#include <stdio.h>
int make_used;
namespace NS {
static int my_val = 2112;
static void NSFunc(void) {
make_used += my_val;
}
}
int main() {
{
using namespace NS;
// Set BP2, eval my_val, Exp: 2112 Act: ambiguous
printf("\neval @BP2 line=%d: my_val = %d", __LINE__, my_val);
}
return make_used == 0;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>