June 13, 2010 [Issue 4303] New: __traits(compiles) returns wrong result when used recursively | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4303 Summary: __traits(compiles) returns wrong result when used recursively Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: patch, wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: r.sagitario@gmx.de --- Comment #0 from Rainer Schuetze <r.sagitario@gmx.de> 2010-06-13 03:16:47 PDT --- compiling this code: /// template foo() if (__traits(compiles,undefined)) { enum foo = false; } template foo() if (true) { enum foo = true; } pragma(msg,__traits(compiles,foo!())); const bool bar = foo!(); ///// compiles, but outputs: false This is caused by __traits(compiles) not restoring the global error count in recursive calls (more specifically: when the error output is gagged before evaluating __traits). Here's the patch: Index: traits.c =================================================================== --- traits.c (revision 532) +++ traits.c (working copy) @@ -397,8 +397,8 @@ global.gag--; if (errors != global.errors) - { if (global.gag == 0) - global.errors = errors; + { + global.errors = errors; goto Lfalse; } } Issue 3448 seems similar, but this patch does not help there. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 28, 2010 [Issue 4303] __traits(compiles) returns wrong result when used recursively | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=4303 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2010-06-28 11:35:53 PDT --- http://www.dsource.org/projects/dmd/changeset/565 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation