D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11375 - [profile+nothrow] Semantic 'no throw' error with -profile switch
Summary: [profile+nothrow] Semantic 'no throw' error with -profile switch
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2013-10-29 01:32 UTC by Paolo Invernizzi
Modified: 2013-11-16 03:30 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Paolo Invernizzi 2013-10-29 01:32:13 UTC
This is compiled correctly without the '-profile' switch, it will fails otherwise (DMD 2.063.2, 2.064.beta.4):

    module b;
    class B {
        this() {}
    }

    module a;
    import b;

    class C : B {}
    class D(X) : X {}
    alias D!(C) Z;

    dmd -profile a.d
    Error: 'a.C.this' is not no throw
Comment 1 yebblies 2013-11-14 07:27:43 UTC
class B {
    this() {}
}

class D() : B {}

void main() nothrow
{
    auto d = new D!()();
}

The check for throwing is run _before_ adding the implicit super call, so D.__ctor is inferred as nothrow.  With -profile, the blockExit is run again to determine if a try-finally is necessary, and it errors on the super call.

https://github.com/D-Programming-Language/dmd/pull/2765
Comment 2 github-bugzilla 2013-11-16 03:27:25 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f633cf3796920ff7c3062cc0218e2b2654f8630c
Fix Issue 11375 - [profile+nothrow] Semantic 'no throw' error with -profile switch

https://github.com/D-Programming-Language/dmd/commit/c5147ac15bc5cca6dbfd53f33505b7f1d06e4098
Merge pull request #2765 from yebblies/issue11375

Issue 11375 - [profile+nothrow] Semantic 'no throw' error with -profile switch