www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7322] New: Taking address of deprecated functions isn't refused

reply d-bugmail puremagic.com writes:
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



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: -------
Jan 19 2012
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 31 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7322




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


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: -------
Jul 17 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7322


edmccard verizon.net changed:

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






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: -------
Jul 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7322





 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: -------
Jul 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7322




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bdb1f13fa9124a56dda0b36697b394e890758241


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: -------
Jul 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7322





 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: -------
Jul 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7322




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: -------
Jul 27 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7322


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

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



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: -------
Jul 04 2013