Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #357 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

extern function not implicitly casted to equivalent with d-linkage when passed as an argument

Reported by: noirgel Assigned to: ChristianK
Priority: major Milestone:
Component: unspecified Version: hg tip
Keywords: Cc: bioinfornatics@gmail.com

Description

Functions declared extern cannot be taken by a function declared with a tuple generated from an equivalent function with D linkage.

Better explained with this example code, that fails to compile in linux 64 bits.

import tango.core.Traits;

extern (C) alias void function() CFunc;

void foo(CFunc f) {}

void bar(ParameterTupleOf!(foo)) {}

void main() {
    CFunc fp;
    bar(fp);
}

Output:

test.d(11): Error: function test.bar ((void function() _param_0)) does not match parameter types (voidC function()) test.d(11): Error: cannot implicitly convert expression (fp) of type voidC function() to void function()

The same code compiles with DMD 1.046

Change History

08/07/10 13:32:31 changed by bioinfornatics

  • cc set to bioinfornatics@gmail.com.

12/19/10 12:02:05 changed by mwarning

  • status changed from new to closed.
  • resolution set to fixed.

fixed in 1701:b3627edc659e

Copyright © 2008, LDC Development Team.