Summary: documentation claims non-existent limitation of nested
                    aggregate member functions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: websites

--- Comment #0 from 2012-02-07 10:57:52 PST --- claims:

Member functions of nested classes and structs do not have access to the stack
variables of the enclosing function, but do have access to the other symbols:

void test() {
  int j;
  static int s;

  struct Foo {
    int a;

    int bar() {
      int c = s;  // ok, s is static
      int d = j;  // error, no access to frame of test()

      int foo() {
        int e = s;    // ok, s is static
        int f = j;    // error, no access to frame of test()
        return c + a; // ok, frame of bar() is accessible,
                      // so are members of Foo accessible via
                      // the 'this' pointer to

      return 0;

However, this is wrong. DMD compiles the code fine.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to