[Issue 12979] Nothrow violation error is hidden by inline assembler

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jun 28 23:19:25 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12979

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
Copy my comment from https://issues.dlang.org/show_bug.cgi?id=11471#c6
-----

The root issue is in FuncDeclaration::semantic3.

    ...
    else if (hasReturnExp & 8)               // if inline asm
    {
        flags &= ~FUNCFLAGnothrowInprocess;
    }
    else
    {
        // Check for errors related to 'nothrow'.
        unsigned int nothrowErrors = global.errors;
        int blockexit = fbody->blockExit(this, f->isnothrow);
        if (f->isnothrow && (global.errors != nothrowErrors) )
            ::error(loc, "%s '%s' is nothrow yet may throw", kind(),
toPrettyChars());
    ...

In front-end, if a function body has inline asm statements, the function's
nothrow check is skipped! But many functions in druntime rely on the loose
behavior currently.

--


More information about the Digitalmars-d-bugs mailing list