Thread overview
[Issue 1680] New: static struct constructor overloaded with method prevents compilation in inner function
Nov 21, 2007
d-bugmail
Feb 24, 2013
Kenji Hara
Mar 01, 2013
Walter Bright
November 21, 2007
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);
  }
}


-- 

February 24, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=1680


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

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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-02-23 20:36:43 PST ---
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: -------
March 01, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=1680



--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2013-03-01 02:44:31 PST ---
Fixed for D2.

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