Thread overview
[Issue 7322] New: Taking address of deprecated functions isn't refused
Feb 01, 2012
yebblies
Jul 19, 2012
Kenji Hara
Jul 19, 2012
yebblies
Jul 19, 2012
Kenji Hara
Jul 04, 2013
Kenji Hara
January 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322

           Summary: Taking address of deprecated functions isn't refused
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2012-01-19 11:23:32 PST ---
In DMD 2.058head std.string.rjustify is deprecated, so this program:


import std.string;
void main() {
    rjustify!string("hello", 10);
}


Gives the correct error message:
test.d(3): Error: function std.string.rjustify!(string).rjustify is deprecated


But this program gives no deprecated errors:


import std.string;
void main() {
    auto J = &rjustify!string;
    J("hello", 10);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |yebblies@gmail.com
           Platform|x86                         |All
         AssignedTo|nobody@puremagic.com        |yebblies@gmail.com
         OS/Version|Windows                     |All


--- Comment #1 from yebblies <yebblies@gmail.com> 2012-02-01 15:00:40 EST ---
https://github.com/D-Programming-Language/dmd/pull/670

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322



--- Comment #2 from github-bugzilla@puremagic.com 2012-07-17 00:09:11 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/27134abfb05ef9218e8d6139fe29219b2be4902b Issue 7322 - Taking address of deprecated functions isn't refused

AddrExp::semantic is missing a check when e1 is a VarExp.

https://github.com/D-Programming-Language/dmd/commit/d5dc77452b7f6d0c0768bf33ff3f8172fc0cc482 Merge pull request #670 from yebblies/issue7322

Issue 7322 - Taking address of deprecated functions isn't refused

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322


edmccard@verizon.net changed:

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


--- Comment #3 from edmccard@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: -------
July 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322



--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-19 08:57:10 PDT ---
(In reply to comment #3)
> 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.)

An example that accidentally rejected with current git head:

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

void main()
{
    int function(float) fp1 = &foo;
    // test.d(10): Error: function test.foo is deprecated  <- Bad!
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322



--- Comment #5 from github-bugzilla@puremagic.com 2012-07-19 09:00:18 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bdb1f13fa9124a56dda0b36697b394e890758241 Revert "Merge pull request #670 from yebblies/issue7322"

This reverts commit d5dc77452b7f6d0c0768bf33ff3f8172fc0cc482, reversing changes made to 00778d310b6980ac7068398f4dac22aa4860b8d4.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|pull                        |
         AssignedTo|yebblies@gmail.com          |nobody@puremagic.com


--- Comment #6 from yebblies <yebblies@gmail.com> 2012-07-20 02:27:42 EST ---
The deprecation check needs to be done where the overload set is resolved, wherever that is.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322



--- Comment #7 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-19 09:37:43 PDT ---
(In reply to comment #6)
> The deprecation check needs to be done where the overload set is resolved, wherever that is.

DotVarExp and VarExp have `hasOverloads` field that means whether the
overloaded symbol is really resolved or not.
In these cases, CastExp::semantic and AddrExp::implicitConvTo might be better
places.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7322



--- Comment #8 from edmccard@verizon.net 2012-07-27 20:34:11 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1064

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7322


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #9 from Kenji Hara <k.hara.pg@gmail.com> 2013-07-04 07:36:18 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2130

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