D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7526 - void functions passed to getopt die
Summary: void functions passed to getopt die
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-16 14:36 UTC by Bernard Helyer
Modified: 2014-03-24 10:33 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Bernard Helyer 2012-02-16 14:36:29 UTC
import std.getopt;

void usage() {}

void main(string[] args)
{
    getopt(args, "help", {usage();});
}

This works in 2.057 and Andrei believes it is intended to work.
Comment 1 SomeDude 2012-04-20 00:54:51 UTC
See also issue 7426 and issue 7493
Comment 2 SomeDude 2012-04-20 00:57:20 UTC
(In reply to comment #1)
> See also issue 7426 and issue 7493

Oh my, I meant issue 7421 and  issue 7693
Comment 3 Andrej Mitrovic 2014-03-24 10:33:54 UTC
-----
import std.getopt;

void usage() { assert(0); }  // will throw

void main(string[] args)
{
    getopt(args, "help", {usage();});
}
-----

Seems to work in 2.064/2.065.