[Bug 24994] New: Wrong value when evaluating a shadowed global inside the namespace

Bug ID 24994
Summary Wrong value when evaluating a shadowed global inside the namespace
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter dawn+bugzilla@burble.org
CC llvm-bugs@lists.llvm.org
Classification Unclassified

If a global identifier is over shadowed in a namespace, evaluating the global
inside the namespace returns the value of the identifier in the namespace, not
the global. See comments in the following test case.  This started with lldb
r247746.  (Note: test case was tested with clang based on svn 3.4, 3.6 and
trunk on OSX).

    #include <stdio.h>
    int make_used;
    static int ScNSpacGl = 2100;
    namespace NS2 {
        static int ScNSpacGl = 2111;
        static void NS2Func(void) {
            // Set BP here, eval ::ScNSpacGl, Exp: 2100 Act: 2111
            printf("eval @BP line=%d: ::ScNSpacGl = %d\n", __LINE__,
::ScNSpacGl);
            make_used += ScNSpacGl;
        }
    }
    int main(int argc, char **argv) {
        NS2::NS2Func();
        return make_used == 0;
    }