www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 190] New: Cannot forward reference typedef/alias in default value for function parameter

http://d.puremagic.com/bugzilla/show_bug.cgi?id=190

           Summary: Cannot forward reference typedef/alias in default value
                    for function parameter
           Product: D
           Version: 0.160
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com


Possibly related to Bug 184.

--
typedef int avocado;
void eat(avocado x = .x);
avocado x;
--

The above code fails to compile with the error "cannot implicitly convert
expression (x) of type avocado to avocado". Changing the typedef to an alias
causes "cannot implicitly convert expression (x) of type avocado to int"
instead.

Placing the declaration of "x" before the declaration of "eat" makes it compile
just fine.


-- 
Jun 11 2006