D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3268 - can't compare pointer to functions when one is const
Summary: can't compare pointer to functions when one is const
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2009-08-27 14:10 UTC by Andrei Alexandrescu
Modified: 2015-06-09 01:20 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2009-08-27 14:10:00 UTC

    
Comment 1 Andrei Alexandrescu 2009-08-27 14:11:13 UTC
void fun() {}

void main()
{
    auto a = &fun;
    const b = a;
    assert(a == b);
}

This fails to compile. The error message is odd too:

Error: array equality comparison type mismatch, void function() vs const(void function())

The code should work.
Comment 2 yebblies 2011-06-06 20:37:46 UTC
Possible fix: https://github.com/D-Programming-Language/dmd/pull/89
Comment 3 yebblies 2011-06-08 04:41:23 UTC
Better fix: https://github.com/D-Programming-Language/dmd/pull/96