digitalmars.D.bugs - [Issue 11720] New: tupleof inconsistency
- d-bugmail puremagic.com (33/33) Dec 10 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (26/26) Dec 10 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (10/10) Dec 10 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (13/14) Dec 10 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (19/25) Dec 10 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (10/10) Dec 11 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (28/29) Dec 11 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (15/15) Dec 11 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (13/13) Dec 25 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11720
- d-bugmail puremagic.com (11/11) Jan 30 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11720
https://d.puremagic.com/issues/show_bug.cgi?id=11720 Summary: tupleof inconsistency Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: critical Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: timothee.cour2 gmail.com 16:55:31 PST --- import std.stdio; void main(){ struct A{ int x; int x2; } A a; fun(a); } void fun(T)(T a){ foreach(i, member; a.tupleof) { static temp=a.tupleof[i].stringof; string name = a.tupleof[i].stringof[2..$]; writeln(i," ",temp," ",name);//prints 0 a.x x then 1 a.x x2 assert(name==temp[2..$]);//fails } } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 10 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|tupleof inconsistency |Function-local static | |variables should cause | |"already defined in another | |scope" error This is unrelated bug to tupleof property. compile-time iterated foerach loop is unrolled to multiple scope statements. foreach (T; TypeTuple!(int, double)) { static temp = T.stringof; } // is equivalent to: { static temp = int.stringof; } { static temp = double.stringof; } Then, two static temp variables have exactly same mangled name, so they conflicts and should cause linker error at least. However, all of instantiated code will be placed in COMDAT section, so they incorrectly share the storage. Changed the summary. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 10 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull, wrong-code https://github.com/D-Programming-Language/dmd/pull/2947 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 10 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720 Orvid King <blah38621 gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |blah38621 gmail.comhttps://github.com/D-Programming-Language/dmd/pull/2947Is having it error really the right way to fix this? It looks to me to be an issue with the fact that the bodies of a statically expanded foreach are not specially mangled. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 10 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720Yes. In D, function local declarations which are assigned to global symbols cannot have same name because of the mangled name conflict. void main() { { void f() {} } { void f() {} } // Error: declaration f is already defined in another scope in main { struct S {} } { struct S {} } // Error: declaration S is already defined in another scope in main { static int v = 1; } { static int v = 1; } // should be same error } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------https://github.com/D-Programming-Language/dmd/pull/2947Is having it error really the right way to fix this? It looks to me to be an issue with the fact that the bodies of a statically expanded foreach are not specially mangled.
Dec 10 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720 Max Samukha <samukha voliacable.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |samukha voliacable.com PST --- Looks like a design mistake. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 11 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720 PST ---Looks like a design mistake.FWIW, C++ seems to do a sane thing. Class decls do not conflict and the assertion passes: int main(int argc, char *argv[]) { int *x1; int *x2; { class C { }; static int x; x1 = &x; } { class C { }; static int x; x2 = &x; } assert(x1 != x2); } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 11 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720 While yes I would agree that: { static int v = 1; } { static int v = 1; } Should be an error, and thus the PR should be merged. I don't agree that the reason this issue was created: foreach (T; TypeTuple!(int, double)) { static temp = T.stringof; } should be an error, sorry if I failed to explain myself well enough originally. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 11 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0b575f80b644715207ff18ca92d7bfb4708186aa fix Issue 11720 - Function-local static variables should cause "already defined in another scope" error https://github.com/D-Programming-Language/dmd/commit/5901e163e48a5f13a5a1d970741229b3c2878e0d Issue 11720 - Function-local static variables should cause "already defined in another scope" error -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 25 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11720 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 03:39:14 PST --- Mark as fixed? As for avoiding mangling issues, I think this is Issue 3031. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2014