digitalmars.D.bugs - [Issue 2257] New: Template value parameters behave like alias parameters
- d-bugmail puremagic.com (24/24) Jul 31 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2257
- d-bugmail puremagic.com (4/4) Oct 12 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2257
- d-bugmail puremagic.com (24/24) Oct 13 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2257
- d-bugmail puremagic.com (11/28) Nov 06 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2257
- d-bugmail puremagic.com (10/10) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2257
- d-bugmail puremagic.com (10/10) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2257
- d-bugmail puremagic.com (6/6) Jan 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2257
- d-bugmail puremagic.com (39/39) Feb 05 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2257
- d-bugmail puremagic.com (14/14) Feb 04 2013 http://d.puremagic.com/issues/show_bug.cgi?id=2257
http://d.puremagic.com/issues/show_bug.cgi?id=2257 Summary: Template value parameters behave like alias parameters Product: D Version: 2.017 Platform: PC OS/Version: Windows Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: samukha voliacable.com import std.stdio; template Foo(string s) { enum Foo = s; // changing enum to invariant fixes the issue. } void main() { string a = "str"; alias Foo!(a) b; // b is now an alias of a. Should be a compiler error } --
Jul 31 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2257 "compiler error" in the example was meant to be "compile error" --
Oct 12 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2257 Rob Jacques <sandford jhu.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sandford jhu.edu This issue causes major issues with Nd-array and Small Vector implementations, as the incorrect type signatures play havoc with other templated functions. Here is another test case illustrating the problem: import std.stdio; struct Matrix(T,size_t D) { Matrix!(U,D) foo(U)(U v) { return Matrix!(U,D)(); } } void main() { real r; size_t d = 2; Matrix!(float,2) m; writeln(typeof( m.foo(r) ).stringof); //writes Matrix(float,D) Matrix!(float,d) n; writeln(typeof( n ).stringof); //writes Matrix(float,d) } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 13 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2257This issue causes major issues with Nd-array and Small Vector implementations, as the incorrect type signatures play havoc with other templated functions. Here is another test case illustrating the problem: import std.stdio; struct Matrix(T,size_t D) { Matrix!(U,D) foo(U)(U v) { return Matrix!(U,D)(); } } void main() { real r; size_t d = 2; Matrix!(float,2) m; writeln(typeof( m.foo(r) ).stringof); //writes Matrix(float,D) Matrix!(float,d) n; writeln(typeof( n ).stringof); //writes Matrix(float,d) }A Mitigation for the above example: Matrix!(U,D+0) foo(U)(U v) { return Matrix!(U,D)(); } changes "Matrix(float,D)" to "writes Matrix(float,2u)" However, the original template type is still distinct: Matrix(float,2) Also, it appears that even though D is unsigned, the template type is signed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 06 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2257 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc *** Issue 4289 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: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2257 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au Bug 2550 has the same root cause, I think. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2257 *** Issue 2733 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: -------
Jan 29 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2257 Stewart Gordon <smjg iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com This might be related: ---------- struct DimensionedValue(Val, int Dim) { Val value; auto opMul(T)(T v) { return DimensionedValue!(typeof(value * T.init), Dim)(value * v); } } template isDimensionedValue(T : DimensionedValue!(V, D), V, int D) { enum bool isDimensionedValue = true; } template isDimensionedValue(T) { enum bool isDimensionedValue = false; } DimensionedValue!(int, 1) x; //DimensionedValue!(double, 1) y; pragma(msg, typeof(x * 2)); pragma(msg, isDimensionedValue!(typeof(x * 2))); pragma(msg, typeof(x * 2.5)); pragma(msg, isDimensionedValue!(typeof(x * 2.5))); ---------- DimensionedValue!(int,1) true DimensionedValue!(double,Dim) false ---------- Reinstating the declaration of y suppresses the bug. As does using Dim + 0 in opMul. Is this another manifestation of the same bug, or does it warrant a separate bug report? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 05 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2257 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich gmail.com Platform|x86 |All Resolution| |WORKSFORME OS/Version|Windows |All 17:55:12 PST --- Fixed since a long time ago, tested as far back as 2.053. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 04 2013