digitalmars.D.bugs - [Issue 8683] New: bad type resolution for template property functions
- d-bugmail puremagic.com (41/41) Sep 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8683
- d-bugmail puremagic.com (10/10) Oct 04 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8683
- d-bugmail puremagic.com (25/25) Oct 05 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8683
- d-bugmail puremagic.com (6/6) Oct 05 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8683
- d-bugmail puremagic.com (11/12) Oct 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8683
http://d.puremagic.com/issues/show_bug.cgi?id=8683 Summary: bad type resolution for template property functions Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: ellery-newcomer utulsa.edu --- Comment #0 from Ellery Newcomer <ellery-newcomer utulsa.edu> 2012-09-17 21:00:30 PDT --- code: property int Foo()() { return 1; } property int Goo() { return 1; } pragma(msg, typeof(Foo)); pragma(msg, typeof(Goo)); void main() { import std.stdio; writeln(Foo); writeln(Goo); } should spit out int int does spit out void int when compiled. prints 1 1 when ran. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8683 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com --- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-10-04 18:59:29 PDT --- Maybe typeof(Foo!()) is required here? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 04 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8683 Maxim Fomin <maxim maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim maxim-fomin.ru --- Comment #2 from Maxim Fomin <maxim maxim-fomin.ru> 2012-10-05 10:35:47 PDT --- (In reply to comment #0)<skip> It may or may not be a bug depending on what spec says and it says little about it. Dlang.org template page says that semantic analysis is done after template instantiation and in your case it is not instantiated. On the one hand, it is obvious that return type does not vary and is always int. On the other hand, dmd is not obligated to do so until full template instantiation. TDPL p.139-140 says that D uses heterogeneous translation which means that int Foo()() is not a compiled function like int Goo(). At p.236 it additionally says that Foo()() is not a type, it's a means to create a type. This means that asking a typeof from something that is not a type is problematic. The key point here is whether typeof(Foo) should instantiate type or not for templates like Foo. If it should instantiate, then it should correctly parse return type. If not (and it seems that typeof of templates which cannot be easily instantiated as Foo), than typeof should return some invalid type (like void) or just issue error. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 05 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8683 --- Comment #3 from Maxim Fomin <maxim maxim-fomin.ru> 2012-10-05 10:37:03 PDT --- This code demonstrates the issue http://dpaste.dzfl.pl/9f2cc42f -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 05 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8683 --- Comment #4 from Ellery Newcomer <ellery-newcomer utulsa.edu> 2012-10-07 17:51:37 PDT --- (In reply to comment #1)Maybe typeof(Foo!()) is required here?That does work, but I don't see why pragma(msg, typeof(Foo)); should fail while writeln(Foo); succeeds. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 07 2012