digitalmars.D.bugs - [Issue 4303] New: __traits(compiles) returns wrong result when used recursively
- d-bugmail puremagic.com (54/54) Jun 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4303
- d-bugmail puremagic.com (12/12) Jun 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4303
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 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: -------
Jun 13 2010
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 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: -------
Jun 28 2010