Can't print inout parameter

Jacob Carlborg doob at me.com
Thu Oct 4 23:34:40 PDT 2012


The example below fails to compile:

inout(int) foo (inout int a)
{
     writeln(a);
     return a;
}

void main ()
{
     foo(1);
}

If I remove the call to "writeln" it compiles.

DMD 2.060 on Mac OS X, error message:

conv.d(3572): Error: template instance Unqual!(__T4ImplTNgiZ) 
Unqual!(__T4ImplTNgiZ) does not match template declaration Unqual(T)
conv.d(3572): Error: Unqual!(__T4ImplTNgiZ) is used as a type
stdio.d(692): Error: template instance 
std.conv.toTextRange!(inout(int),LockingTextWriter) error instantiating
stdio.d(1595):        instantiated from here: write!(inout(int),char)
main.d(10):        instantiated from here: writeln!(inout(int))
stdio.d(1595): Error: template instance 
std.stdio.File.write!(inout(int),char) error instantiating
main.d(10):        instantiated from here: writeln!(inout(int))
main.d(10): Error: template instance std.stdio.writeln!(inout(int)) 
error instantiating
Failed: /Users/jacob/.dvm/bin/dvm-current-dc  -v -o- 
'/Users/jacob/development/d/main.d' -I'/Users/jacob/development/d' 
 >/Users/jacob/development/d/main.d.deps

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list