[Bug 190] New: Cannot forward reference typedef/alias in default value for function parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 11 04:46:41 PDT 2006
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 at digitalmars.com
ReportedBy: deewiant at 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.
--
More information about the Digitalmars-d-bugs
mailing list