www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1680] New: static struct constructor overloaded with method prevents compilation in inner function

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1680

           Summary: static struct constructor overloaded with method
                    prevents compilation in inner function
           Product: D
           Version: 2.007
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: schveiguy yahoo.com


Not sure if this is the minimal case.  Also happens on d 1.023

struct X
{
  int _y;
  int blah()
  {
    return _y;
  }

  static X blah(int n)
  {
    return X(n);
  }

  static X blah2(int n)
  {
    return X(n);
  }

  static X blah2(char[] n)
  {
    return X(n.length);
  }
}

void main()
{
  // OK
  X v = X.blah(5);
  void f()
  {
    // OK
    X v1 = X.blah2(5);
    X v2 = X.blah2("hello".dup);

    // Error: 'this' is only allowed in non-static member functions, not f
    X v3 = X.blah(5);
  }
}


-- 
Nov 20 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1680


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/1687

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1680




02:44:31 PST ---
Fixed for D2.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 01 2013