[Issue 3573] New: pure and nothrow are not enforced when function has no return type specified
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 4 02:39:36 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3573
Summary: pure and nothrow are not enforced when function has no
return type specified
Product: D
Version: 2.036
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: michal.minich at gmail.com
--- Comment #0 from Michal Minich <michal.minich at gmail.com> 2009-12-04 02:39:36 PST ---
there are 3 related problems:
1. it is possible to declare function without specifying return type.
pure foo () {}
pure foo () {}
pure nothrow foo () {}
should be: pure nothrow void foo () {}
2. pure is not enforced when return type is omitted
int bar = 3;
pure foo () { bar = 42; }
void main ()
{
writeln (bar); // writes 3
foo ();
writeln (bar); // writes 42
}
3. nothrow is not enforced when return type is omitted
nothrow foo () { throw new Exception (""); }
void main ()
{
foo (); // throws exception
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list