[lldb-dev] [Bug 24995] New: Evaluating a variable shadowed inside a block gets ambiguity error since r247836

via lldb-dev lldb-dev at lists.llvm.org
Tue Sep 29 18:04:32 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24995

            Bug ID: 24995
           Summary: Evaluating a variable shadowed inside a block gets
                    ambiguity error since r247836
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: dawn+bugzilla at burble.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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;
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150930/33810961/attachment-0001.html>


More information about the lldb-dev mailing list