www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11491] New: safe prefix allows procedures without return type

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11491

           Summary:  safe prefix allows procedures without return type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: burg.basile yahoo.com


--- Comment #0 from burg.basile yahoo.com 2013-11-10 01:23:32 PST ---
description:
-----------
A missing "void" keyword is not detected by dmd 2.064.2 when the function is
prefixed with the  safe,  trusted or  system attribute.
The error message "function declaration without return type" is not displayed.

verified on:
-----------
dmd 2.064.2, win7
all the other d2 compiler currently defined at DPaste.

other infos:
-----------
- the problem doesn't append with an UDA.
- the problem doesn't append if the attribute is put after the declaration.

example:
-------

---
import std.stdio;
import std.traits;

// void KW is missing but it compiles.
template foo(T)
{
     safe a(out int param) 
    {
        param = 654564;
    }
     trusted b(out int param) 
    {
        param = 654564;
    }
     system c(out int param) 
    {
        param = 654564;
    }
}
/*
//void KW is missing and it doesn't compile.
template bar(T)
{
    a(out int param)  safe
    {
        param = 654564;
    }
}*/


void main(string[] args)
{
    int p = 0;

    foo!int.a(p);
    writeln(p);

    assert( isSafe!(foo!int.a) );


    /*p = 0;
    bar!int.a(p);*/
}
---

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 10 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11491


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2013-11-10 02:12:11 PST ---
I think this is not a bug, and this issue should be closed. Think of it as a
feature, that saves you a bit of code. I think this feature doesn't make the D
code more bug-prone.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 10 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11491


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-11-10
09:27:31 PST ---
It's a dupe report (can't find it right now), and it's highly debated in the
community whenever it pops up.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 10 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11491


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE


--- Comment #3 from yebblies <yebblies gmail.com> 2013-11-17 18:08:31 EST ---
*** This issue has been marked as a duplicate of issue 3573 ***

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