[Issue 4899] Ddoc's warnings about stray parens should include file and line numbers
http://d.puremagic.com/issues/show_bug.cgi?id=4899 --- Comment #2 from Jonathan M Davis jmdavisp...@gmx.com 2010-09-20 23:47:02 PDT --- /++ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +/ module d; void main() { } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4904] New: Win32 phobos unittest crashes with access violation
http://d.puremagic.com/issues/show_bug.cgi?id=4904 Summary: Win32 phobos unittest crashes with access violation Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: blocker Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rsi...@gmail.com --- Comment #0 from Shin Fujishiro rsi...@gmail.com 2010-09-21 00:54:02 PDT --- dmd r680 phobos trunk r2043 Paste the following code at the bottom of phobos/unittest.d. This simply increases the size of unittest executable. unittest { struct K(Q...) { static if (Q.length 5) static K!(Q, int) next; Q q; } static K!byte a1; static K!short a2; static K!int a3; static K!long a4; static K!ubyte a5; static K!ushort a6; static K!uint a7; static K!ulong a8; static K!float a9; static K!double a10; static K!real a11; static K!char a12; static K!wchar a13; static K!dchar a14; } Then, run the phobos unittest on Windows. It will crash. make -f win32.mak unittest ... unittest object.Error: Access Violation Access violation seems to start happening when the size of executable exceeds some critical point. Sometimes the AV didn't occur, and alternatively the test showed weird behavior - such as infinitely failing unittests or broken output. See this message and follow ups. http://lists.puremagic.com/pipermail/phobos/2010-September/002609.html Auto tester output: http://d.puremagic.com/test-results/test_data.ghtml?dataid=3525 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4905] New: Variadic constructors don't compile for classes
http://d.puremagic.com/issues/show_bug.cgi?id=4905 Summary: Variadic constructors don't compile for classes Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: ivan.melnychu...@gmail.com --- Comment #0 from vano ivan.melnychu...@gmail.com 2010-09-21 03:38:45 PDT --- This is an issue similar to earlier reported and fixed for *struct* (see http://d.puremagic.com/issues/show_bug.cgi?id=2596). Using DMD v2.049 on Windows, the code for *struct* compiles whereas for *class* does not. If there is only *variadic* parameter - everything works, but as soon as other parameters are added before, the call to *ctor()* does not compile: struct S2 { // Good this(T...)(in string msg, T args) { } } class C1 { // Good this(T...)(T args) { } } class C2 { // Compiles, but ctor() fails this(T...)(in string msg, T args) { } } S2 s2 = S2(); // works auto c1 = new C1(); // works auto c2 = new C2(test); // ERROR: does not compile with Error: no constructor for C2 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3554] Ddoc generats invalid output for documentation comments with non paired paranthasis
http://d.puremagic.com/issues/show_bug.cgi?id=3554 bearophile_h...@eml.cc changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #14 from bearophile_h...@eml.cc 2010-09-21 04:28:18 PDT --- Reopened because the problem isn't solved yet. See Comment 8. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4906] New: Dereferencing null error in a single expression
http://d.puremagic.com/issues/show_bug.cgi?id=4906 Summary: Dereferencing null error in a single expression Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2010-09-21 04:44:16 PDT --- To find null dereferencing in code the compiler probably needs to perform flow analysis. But the compiler can spot and flag as errors at compile-time expressions that follow explicit comparisons to null: if (obj is null obj.foo()) { ... Where the programmer probably meant to write: if (obj !is null obj.foo()) { ... Or: if (obj is null || obj.foo()) { ... This test doesn't cover several cases of dereference null errors that span different lines of code, but the cases it covers seem common enough to me. See also bug 4595 See also bug 4571 See also: http://code.google.com/intl/en-EN/webtoolkit/tools/codepro/doc/features/audit/audit_rules_com.instantiations.assist.eclipse.auditGroup.semanticErrors.html#com.instantiations.assist.eclipse.analysis.audit.rule.dereferencingNullPointer -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4595] Accessing non-static member of a null reference compiles
http://d.puremagic.com/issues/show_bug.cgi?id=4595 --- Comment #11 from bearophile_h...@eml.cc 2010-09-21 04:45:47 PDT --- See also bug 4906 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4905] Variadic constructors don't compile for classes with other arguments
http://d.puremagic.com/issues/show_bug.cgi?id=4905 nfx...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED CC||nfx...@gmail.com Resolution||DUPLICATE --- Comment #1 from nfx...@gmail.com 2010-09-21 04:59:11 PDT --- It's a variadic template, not a variadic parameter. *** This issue has been marked as a duplicate of issue 435 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 435] Constructors should be templatized
http://d.puremagic.com/issues/show_bug.cgi?id=435 nfx...@gmail.com changed: What|Removed |Added CC||ivan.melnychu...@gmail.com --- Comment #3 from nfx...@gmail.com 2010-09-21 04:59:11 PDT --- *** Issue 4905 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4907] New: Catching more simple out-of-bounds errors at compile-time
http://d.puremagic.com/issues/show_bug.cgi?id=4907 Summary: Catching more simple out-of-bounds errors at compile-time Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2010-09-21 05:07:24 PDT --- One of the advantages of static typing is that it catches some classes of bugs early, instead of later at runtime. Similarly, catching array out-of-bounds errors early at compile-time is better than catching them at run-time in debug builds. Catching all cases of out-of-bounds errors at compile time is not possible and it's hard to do, but there are simple cases that are common coding mistakes and probably easy to catch at compile-time: void main() { int[10] arr; for (int i = 0; i = arr.length; i++) arr[i] = i; } In idiomatic D that kind of bugs is less common because explicitly bounded loops are less common: void main() { int[10] arr; foreach (i, ref x; arr) x = i; } But probably there are enough D programmers that don't use idiomatic D or translate code from Java/C/C++/C# code that contains explicit loops. Currently DMD is able to spot such out-of-bounds errors at compile-time only if the index is a compile-time constant: const int i = 6 / 2; void main() { int[3] arr; arr[i] = 3; // Error: array index 3 is out of bounds arr[0 .. 3] } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4290] 'Fragile' opCmp/toHash signature errors
http://d.puremagic.com/issues/show_bug.cgi?id=4290 --- Comment #9 from Steven Schveighoffer schvei...@yahoo.com 2010-09-21 06:16:08 PDT --- I will say the fact that sort does not use opCmp, but does is bad. Worse than that, it uses a default opCmp which may appear to work but doesn't really. However the solution is not to disable other useful declarations of opCmp, but rather to fix sort. In fact, I think sort should be deprecated for std.algorithm.sort, which does use any opCmp defined. I'd like to see the whole only save a function pointer in typeinfo if the signature matches exactly just go away. I think we can solve these problems in better ways. It's a legacy thing that we can safely get rid of. Barring that, having a designation so the compiler can make an informed decision would be the second best option. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4899] Ddoc's warnings about stray parens should include file and line numbers
http://d.puremagic.com/issues/show_bug.cgi?id=4899 --- Comment #3 from Johannes Pfau johannesp...@gmail.com 2010-09-21 07:38:26 PDT --- OK, I can confirm that. So the line information is missing if the comment is a module comment. The dmd main function calls Module::gendocfile() which calls DocComment::writeSections() directly. In this case the Module's loc member is never set and therefore the line information is missing, I don't know how to fix this though. In case you're interested why the parenthesis error occurs: The second line in the comment, http://www.boost.org/LICENSE_1_0.txt) is the problem. Because of the colon dmd thinks you define a ddoc section named http with content //www.boost.org/LICENSE_1_0.txt). Because parenthesis must be closed in the section they were opened in the stray parenthesis error occurs. Possible workarounds are: 1. Join those two lines into one 2. Section names cannot contain spaces, so move the 'at' to the second line (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 3. Use a macro. _Every_ macro will work (See accompanying file LICENSE_1_0.txt or copy at $(LINK http://www.boost.org/LICENSE_1_0.txt)) (See accompanying file LICENSE_1_0.txt or copy at $(TEXT http://www.boost.org/LICENSE_1_0.txt)) Macros: TEXT=$0 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4899] Ddoc: Warnings about stray parens do not include file and line numbers for module comments
http://d.puremagic.com/issues/show_bug.cgi?id=4899 --- Comment #4 from Jonathan M Davis jmdavisp...@gmx.com 2010-09-21 09:40:52 PDT --- I did #1 in my code once I figured out what was generating the error, but that's from the license declaration used at the top of pretty much every module in Phobos, so unless they were changed recently, they're likely all generating this error if compiled with -w (I'm not sure whether Phobos is normally compiled with -w or not though). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4904] Win32 phobos unittest crashes with access violation
http://d.puremagic.com/issues/show_bug.cgi?id=4904 Rainer Schuetze r.sagita...@gmx.de changed: What|Removed |Added CC||r.sagita...@gmx.de --- Comment #1 from Rainer Schuetze r.sagita...@gmx.de 2010-09-21 11:07:51 PDT --- Even with phobos svn revision 2014, dmd outputs 16424 symbols for the unittest executable, which triggers bug 3372 in optlink. It can generate any kind of bad behaviour. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4217] Function overloads are not distinguished when instantiating templates
http://d.puremagic.com/issues/show_bug.cgi?id=4217 Shin Fujishiro rsi...@gmail.com changed: What|Removed |Added Attachment #641 is|0 |1 obsolete|| --- Comment #3 from Shin Fujishiro rsi...@gmail.com 2010-09-21 11:16:09 PDT --- Created an attachment (id=762) Patch against dmd r680, implements FuncDeclaration::equals() Updated patch and a cleaned up test case. test.d template Return(alias fun) { static if (is(typeof(fun) R == return)) alias R Return; } interface I { int square(int n); real square(real n); } alias Return!( __traits(getOverloads, I, square)[0] ) R0; alias Return!( __traits(getOverloads, I, square)[1] ) R1; static assert(! is(R0 == R1)); // (14) % dmd -o- -c test.d test.d(14): Error: static assert (!true) is false The problem is that template alias (symbol) parameters are matched in terms of the identifier via Dsymbol::equals(). The new patch implements FuncDeclaration::equals() that checks for function type. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4890] GC.collect() deadlocks multithreaded program.
http://d.puremagic.com/issues/show_bug.cgi?id=4890 Sean Kelly s...@invisibleduck.org changed: What|Removed |Added Status|NEW |ASSIGNED CC||s...@invisibleduck.org --- Comment #1 from Sean Kelly s...@invisibleduck.org 2010-09-21 11:35:29 PDT --- Fixed in druntime changeset 392. Will be in DMD-2.050. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4908] New: Compile-time use of empty() in Tuple failed depending on order of compilation
http://d.puremagic.com/issues/show_bug.cgi?id=4908 Summary: Compile-time use of empty() in Tuple failed depending on order of compilation Product: D Version: D2 Platform: Other URL: http://svn.dsource.org/projects/phobos/tr...@2022 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rsi...@gmail.com --- Comment #0 from Shin Fujishiro rsi...@gmail.com 2010-09-21 12:25:25 PDT --- I have no reduced test case yet. Unzip the dmd 2.049 release. Add the following lines to std/typecons.d: struct Tuple(T...) { + static string test() + { + enum s = ; + return s.empty ? ; : ;; // (316) + } + mixin(test());// (318) public: Then, compiling certain modules fails depending on the order of compilation: % dmd -c std/string std/concurrency std/typecons.d(316): Error: cannot evaluate empty() at compile time std/typecons.d(318): Error: cannot evaluate test() at compile time std/typecons.d(318): Error: argument to mixin must be a string, not (test()) % dmd -c std/concurrency std/string % _ The error didn't occur if I modified std.string.indexOf() as follows: sizediff_t indexOf(Char1, Char2)(in Char1[] s, in Char2[] sub, CaseSensitive cs = CaseSensitive.yes) { if (cs == CaseSensitive.yes) { static if (Char1.sizeof == Char2.sizeof) { - immutable result = s.length - std.algorithm.find(s, sub).length; + immutable result = 0; return result == s.length ? -1 : result; This bug is no longer triggered in phobos since changeset 2032. http://svn.dsource.org/projects/phobos/tr...@2032 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4909] New: Two suggestions for std.algorithm.schwartzSort()
http://d.puremagic.com/issues/show_bug.cgi?id=4909 Summary: Two suggestions for std.algorithm.schwartzSort() Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2010-09-21 12:58:38 PDT --- Both my experience with Python and some practice with D v2 shows me that in script-like programs schwartzSort() is useful very often. Python 3 has even removed the cmp argument for its built-in sort, so it always performs a Schwartz sorting using the key argument, because it's simpler to use. This an usage example of schwartzSort usage, to sort an array of arrays according to the second item in the sub-arrays: import std.algorithm; void main() { auto arr = [[5,9],[5,3],[4,12],[7,8],[12,2],[5,8]]; schwartzSort!((e){ return e[1]; })(arr); assert(arr == [[12,2],[5,3],[7,8],[5,8],[5,9],[4,12]]); } To improve the usage of schwartzSort a support for transform function expressed as string may be added. For non-English speaking programmers the spelling of schwartzSort is not easy, and a so commonly used function may enjoy a shorter name any way, so a keySort name may be better (key refers to the key argument function of the Python sort, that's named transform in Phobos): import std.algorithm; void main() { auto arr = [[5,9],[5,3],[4,12],[7,8],[12,2],[5,8]]; keySort!q{a[1]}(arr); assert(arr == [[12,2],[5,3],[7,8],[5,8],[5,9],[4,12]]); } To help the understanding of this keySort name, in the signature of keySort the transform argument may be renamed key. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3934] Some untidy attributes
http://d.puremagic.com/issues/show_bug.cgi?id=3934 --- Comment #10 from bearophile_h...@eml.cc 2010-09-21 13:28:24 PDT --- Structs can't be subclassed, so protected struct fields seem a bug. This compiles with dmd 2.049: struct Foo { protected int x; } void main() {} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3665] Regression(1.051, 2.036) Assignment with array slicing does not work
http://d.puremagic.com/issues/show_bug.cgi?id=3665 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||FIXED --- Comment #3 from Walter Bright bugzi...@digitalmars.com 2010-09-21 14:01:50 PDT --- http://www.dsource.org/projects/dmd/changeset/681 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4227] Overloading rules not complete in D1 docs
http://d.puremagic.com/issues/show_bug.cgi?id=4227 --- Comment #2 from st...@despam.it 2010-09-21 15:03:59 PDT --- (sorry for the late reply) http://www.digitalmars.com/d/2.0/hijack.html (part of) this also seems to apply to D1. from: http://www.digitalmars.com/d/archives/digitalmars/D/learn/enum_overloading_19868.html#N19875 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4910] New: [CTFE] Cannot evaluate a function that has failed at once
http://d.puremagic.com/issues/show_bug.cgi?id=4910 Summary: [CTFE] Cannot evaluate a function that has failed at once Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rsi...@gmail.com --- Comment #0 from Shin Fujishiro rsi...@gmail.com 2010-09-21 15:33:40 PDT --- If the interpretor failed to evaluate a function with an invalid argument at once, then it fails to evaluate the same function with a valid argument. The following code fails (it should succeed): test1.d int echo(int a) { return a; } template ctfe(int v) { } static int var; static assert(!__traits(compiles, ctfe!(echo(var)) )); enum c = echo(123); // (10) % dmd -o- -c test1.d test1.d(10): Error: cannot evaluate echo(123) at compile time test1.d(10): Error: cannot evaluate echo(123) at compile time But it succeeds if echo(123) is evaluated before the failure. test2.d int echo(int a) { return a; } enum c = echo(123); template ctfe(int v) { } static int var; static assert(!__traits(compiles, ctfe!(echo(var)) )); % dmd -o- -c test2.d % _ -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 666] missing pthread functions
http://d.puremagic.com/issues/show_bug.cgi?id=666 Sean Kelly s...@invisibleduck.org changed: What|Removed |Added CC||s...@invisibleduck.org --- Comment #3 from Sean Kelly s...@invisibleduck.org 2010-09-21 16:15:01 PDT --- These are defined by druntime in D2, so this issue is D1-specific. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4911] New: Bad error messages from attempts to write into read-only File
http://d.puremagic.com/issues/show_bug.cgi?id=4911 Summary: Bad error messages from attempts to write into read-only File Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2010-09-21 17:45:47 PDT --- This is a wrong Python 2 program, it tries to write on a read mode file: f = file(test.raw, r) f.write(hello) Python 2.6.5 gives the run-time error: Traceback (most recent call last): File ...\test.py, line 2, in module f.write(hello) IOError: File not open for writing - This is a similar D2 program: import std.stdio: File; void main() { auto f = File(test.raw, r); f.write(hello); } It generates the run-time error (dmd 2.049): std.exception.errnoexcept...@...\dmd\src\phobos\std\stdio.d(1060): (No error) This error is useless, it doesn't show the line count and file of the problem, the cause of the problem (the file is read-only) and it doesn't even clearly show it's a I/O error. - A similarly wrong D2 program: import std.stdio: File; void main() { double[3] data = [0.5, 1.5, 2.5]; auto f = File(test.raw, r); f.rawWrite(data); } The error it raises, far still from being a good error message: std.exception.errnoexcept...@...\dmd\src\phobos\std\stdio.d(508): Wrote 0 instead of 3 objects of type double to file `test.raw' (No error) A much better error message may be this, that gives the line number and file name of the module that has produced the error, shows that it's an I/O error, explains that the bug comes from trying to write in a read-only file, and it gives the name of the file: fileioexcept...@test.d(5): attempt to write into read-only file test.raw. (Even better, a typestate system is able to spot this bug at compile-time, see bug 4571 ). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4912] New: ICE [expToCBuffer] compile-time access to non-existent AA member
http://d.puremagic.com/issues/show_bug.cgi?id=4912 Summary: ICE [expToCBuffer] compile-time access to non-existent AA member Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: ice-on-valid-code, patch Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rsi...@gmail.com --- Comment #0 from Shin Fujishiro rsi...@gmail.com 2010-09-21 17:50:36 PDT --- Yet another PREC_zero assertion failure in expToCBuffer(). enum aa = [ zero: 0 ]; static assert(aa[one] == 1); % dmd -o- -c test.d Assertion failed: (precedence[e-op] != PREC_zero), function expToCBuffer, file expression.c, line 816. Patch against dmd r680: diff --git src/parse.c src/parse.c index 61b1c2a..4800474 100644 --- src/parse.c +++ src/parse.c @@ -6273,6 +6273,7 @@ void initPrecedence() precedence[TOKnull] = PREC_primary; precedence[TOKstring] = PREC_primary; precedence[TOKarrayliteral] = PREC_primary; +precedence[TOKassocarrayliteral] = PREC_primary; precedence[TOKtypeid] = PREC_primary; precedence[TOKis] = PREC_primary; precedence[TOKassert] = PREC_primary; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4911] Bad error messages from attempts to write into read-only File
http://d.puremagic.com/issues/show_bug.cgi?id=4911 --- Comment #1 from bearophile_h...@eml.cc 2010-09-21 18:06:34 PDT --- I think in Phobos there is not (yet) a function to find the line number and module name of the precedent stack frame, of the caller, so probably the test.d(5) can't be generated in the error message, andthe programmer has to read the stack trace. So a more realistic error message (plus stack trace) is: fileioexcept...@...\dmd\src\phobos\std\stdio.d(508): attempt to write into read-only file test.raw. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4913] Repeated template instantiations with the same symbol argument fails
http://d.puremagic.com/issues/show_bug.cgi?id=4913 Shin Fujishiro rsi...@gmail.com changed: What|Removed |Added Keywords||patch --- Comment #1 from Shin Fujishiro rsi...@gmail.com 2010-09-21 18:43:39 PDT --- This patch fixes the problem (dmd r680): --- src/template.c +++ src/template.c @@ -4641,6 +4641,12 @@ Identifier *TemplateInstance::genIdent() ea = NULL; goto Lsa; } +if (ea-op == TOKdsymbol) +{ +sa = ((DsymbolExp *)ea)-s; +ea = NULL; +goto Lsa; +} buf.writeByte('V'); if (ea-op == TOKtuple) { ea-error(tuple is not a valid template value argument); NOTE: I think the problem is that DsymbolExp::semantic() just returns 'this' if it already run, whereas the function does elaborate AST rewriting. As for this report's case, it rewrites itself to a VarExp *only* at the first semantic run. So, the following patch also fixes the reported problem. --- src/expression.c +++ src/expression.c @@ -2244,8 +2244,10 @@ Lagain: //printf(DsymbolExp:: %p '%s' is a symbol\n, this, toChars()); //printf(s = '%s', s-kind = '%s'\n, s-toChars(), s-kind()); +#if 0 if (type) return this; +#endif if (!s-isFuncDeclaration())// functions are checked after overloading checkDeprecated(sc, s); s = s-toAlias(); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---