[Issue 7322] Taking address of deprecated functions isn't refused

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 18 17:44:11 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7322


edmccard at verizon.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |edmccard at verizon.net


--- Comment #3 from edmccard at verizon.net 2012-07-18 17:44:07 PDT ---
(In reply to comment #2)

The fix from pull #670 gets confused when there are "undeprecated" overloads;
for example, here are several ways that a deprecated function can still be
called through a function pointer:

int foo(int a) { return 0; }
deprecated int foo(float a) { return 1; }

void main()
{
    int function(float) fp1 = &foo;
    auto fp2 = cast(int function(float))&foo;
    assert(fp1(0.0) == 1);
    assert(fp2(0.0) == 1);
}


If foo(int) instead of foo(float) is deprecated, then an error is issued even
though it should be possible to take the address of the undeprecated function.

(I've been having similar problems trying to fix issue 144; in these
situtations, I think AddrExp::semantic is too early in the compilation process
for applying fixes that may be affected by overload resolution.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list