www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 606] New: auto x = property: variable x cannot be declared to be a function

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

           Summary: auto x = property: variable x cannot be declared to be a
                    function
           Product: D
           Version: 0.175
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: godaves yahoo.com


Originally reported here:
http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=9210

module test_prop;
int prop() { return 0; }
void main()
{
  auto x = prop;
}

C:\>dmd test_prop
test_prop.d(4): variable test_prop.main.x cannot be declared to be a function


-- 
Nov 26 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=606


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from bugzilla digitalmars.com  2006-11-30 02:02 -------
That's as designed. Declaring a variable to be a function makes no sense. You
can declare it to be a pointer to a function, though. You can also declare it
to be an alias of a function.


-- 
Nov 30 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=606


wbaxter gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Comment #2 from wbaxter gmail.com  2006-11-30 02:10 -------
(In reply to comment #1)
 That's as designed. Declaring a variable to be a function makes no sense. You
 can declare it to be a pointer to a function, though. You can also declare it
 to be an alias of a function.
 

I think the point of the bug is that because it's invalid to set a variable to a function, this should be interpreted as a function call, and thus make x an int with value 0. --
Nov 30 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=606


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #3 from bugzilla digitalmars.com  2007-07-01 02:13 -------
Works DMD 2.001.


-- 
Jul 01 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=606





------- Comment #4 from thomas-dloop kuehne.cn  2007-07-23 14:55 -------
This issue was fixed by DMD-0.178.

Added to DStress as
http://dstress.kuehne.cn/run/a/auto_20_A.d


-- 
Jul 23 2007