digitalmars.D.bugs - [Issue 4915] New: auto return type escapes function purity
- d-bugmail puremagic.com (25/25) Sep 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4915
- d-bugmail puremagic.com (16/16) Sep 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4915
- d-bugmail puremagic.com (23/23) Nov 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4915
- d-bugmail puremagic.com (13/13) Nov 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4915
- d-bugmail puremagic.com (6/6) Nov 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4915
- d-bugmail puremagic.com (12/12) Nov 10 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4915
http://d.puremagic.com/issues/show_bug.cgi?id=4915
Summary: auto return type escapes function purity
Product: D
Version: 2.039
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: tomash.brechko gmail.com
08:03:34 PDT ---
dmd 2.039 doesn't produce error for pure function with auto return type that
violates purity:
int global;
pure auto f()
{
global = 1;
return 0;
}
compiles without errors.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4915
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug yahoo.com.au
Actually, the bug is something different:
pure auto f() { return 0; }
pure int g() { return f(); }
bug.d(3): Error: pure function 'g' cannot call impure function 'f'
The bug is that for 'auto' functions, 'pure' is ignored.
Bug 3359 is another aspect of the same thing. In fact I think there are about
five bugs which probably all have the same root cause.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4915
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid, patch
This patch also fixes bug 4640, bug 5006, and cases 2 and 3 of bug 3573.
PATCH: func.c, FuncDeclaration::semantic, line 164. All of the
function-related storage classes need to be applied to the function.
(Possibly STCsynchronised as well? Maybe there should be a #define which puts
all of these together, in case the relevant list gets longer).
if (!type->deco)
{
sc = sc->push();
- sc->stc |= storage_class & STCref; // forward to function type
+ sc->stc |= storage_class & (STCref | STCnothrow | STCpure | STCdisable
| STCproperty | STCsafe | STCtrusted | STCsystem); // forward to function
type
if (isCtorDeclaration())
sc->flags |= SCOPEctor;
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4915
Test case (should compile with no errors):
pure nothrow safe auto bug4915a() { return 0; }
pure nothrow safe int bug4915b() { return bug4915a(); }
void bug4915c()
{
pure nothrow safe int d() { return 0; }
int e() pure nothrow safe { return d(); }
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4915 oops, STCproperty shouldn't be in that list. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4915
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla digitalmars.com
Resolution| |FIXED
22:21:09 PST ---
http://www.dsource.org/projects/dmd/changeset/748
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 10 2010









d-bugmail puremagic.com 