www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12041] New: No file+line and strange diagnostic when instantiating WhiteHole

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

           Summary: No file+line and strange diagnostic when instantiating
                    WhiteHole
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



02:01:44 PST ---
Phobos has been emitting this diagnostic lately, the reduced case is:

-----
import std.typecons;

interface I
{
    void bar() nothrow;
}

void main()
{
    new WhiteHole!I;
}
-----

$ dmd test.d
 Warning: WhiteHole!(I) used assert(0) instead of Error for the
auto-implemented nothrow function I.bar
There is no file+line info, and I don't understand the diagnostic at all? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12041


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|DMD                         |Phobos



02:03:09 PST ---
Oh nevermind, it's actually an internal pragma emitted from:

/// ditto
template generateAssertTrap(C, func.../+[BUG 4217]+/)
{
    static if (functionAttributes!(func) & FunctionAttribute.nothrow_) //XXX
    {
        pragma(msg, "Warning: WhiteHole!(", C, ") used assert(0) instead ",
                "of Error for the auto-implemented nothrow function ",
                C, ".", __traits(identifier, func));
        enum string generateAssertTrap =
            `assert(0, "` ~ C.stringof ~ "." ~ __traits(identifier, func)
                    ~ ` is not implemented");`;
    }
    else
        enum string generateAssertTrap =
            `throw new NotImplementedError("` ~ C.stringof ~ "."
                    ~ __traits(identifier, func) ~ `");`;
}

However I still don't understand the diagnostic. I'll change this to be a
library issue.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 30 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12041


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

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




 However I still don't understand the diagnostic. I'll change this to be a
 library issue.
In old days, throwing Error from nothrow function had caused "function foo is nothrow yet may throw" error. As a workaround, WhiteHole used assert(0) instead throwing NotImplementedError for abstract nothrow functions. It's also noted in BUGS section of WhiteHole. BUGS: Nothrow functions cause program to abort in release mode because the trap is implemented with $(D assert(0)) for nothrow functions. But today, the compiler/lamguage limitation is already removed. So we can just remove the workaround code from WhileHole implementation. Phobos fix: https://github.com/D-Programming-Language/phobos/pull/1892 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12041




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/557799fc556f0d5fd3269feb689d258d6bb8debb
fix Issue 12041 - Strange warning pragma when instantiating WhiteHole

Remove restiction in AutoImplement with nothrow function.

https://github.com/D-Programming-Language/phobos/commit/49f6c6ac4b343b28f2e34bcc13e72544334b1802


Issue 12041 - Strange warning pragma when instantiating WhiteHole

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 30 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12041


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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