Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
July 24, 2008 [Issue 2245] New: Possible bug with mixin template functions and variadic params | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2245 Summary: Possible bug with mixin template functions and variadic params Product: D Version: 2.017 Platform: PC OS/Version: Linux Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: derek@hipgraphics.com I posted the following the the language forum thinking perhaps I was doing something wrong, but it seems that this may be a bug in the 2.014 compiler. I also just downloaded the 2.017 compiler, and it gives the same bad result. Here is what I posted: I am trying to create a set of methods that take a variable number of arguments (at compile time). I would have liked to have used template functions to do that, but I need the functions to be virtual, and template functions cannot be virtual. So I thought I would try to use a mixin of a variadic template function. But I am getting a weird compiler error with my simple test program. Here is the test program: 1 import std.stdio; 2 3 template TCALL(ARGS...) 4 { 5 void makecall(ARGS args) 6 { 7 writefln("tcall...", args); 8 } 9 } 10 11 mixin TCALL!(); 12 mixin TCALL!(int); 13 mixin TCALL!(int,int); 14 15 16 class Method 17 { 18 mixin TCALL!(); 19 mixin TCALL!(int); 20 mixin TCALL!(int,int); 21 } 22 23 void main() 24 { 25 auto m = new Method; 26 27 m.makecall(0,1); 28 makecall(0,1); 29 } And when I compile with "Digital Mars D Compiler v2.014" I get this error: test6.d(27): Error: m.makecall is not a declaration test6.d(27): Error: function expected before (), not 1 of type int Can anyone explain what is going on here? It seems like it should work. Note that if you comment out line 27 and compile it compiles fine and runs producing the expected output: tcall...01 -Thanks, Derek -- |
August 25, 2008 [Issue 2245] Bug with overloaded, mixin template functions in classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2245 brunodomedeiros+bugz@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Possible bug with mixin |Bug with overloaded, mixin |template functions and |template functions in |variadic params |classes ------- Comment #1 from brunodomedeiros+bugz@gmail.com 2008-08-25 08:15 ------- This is not related to template variadic params. If you substitute: 3 template TCALL(ARGS...) 4 { 5 void makecall(ARGS args) 6 { 7 writefln("tcall...", args); 8 } 9 } with the 3 expansions: template TCALL() { void makecall() { writefln("tcall..."); } } template TCALL(T1) { void makecall(T1 a1) { writefln("tcall...", a1); } } template TCALL(T1, T2) { void makecall(T1 a1, T2 a2) { writefln("tcall...", a1, a2); } } you still get the same error. It rather seems more like a overload+mixin issue. -- |
July 14, 2011 [Issue 2245] Bug with overloaded, mixin template functions in classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2245 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |k.hara.pg@gmail.com --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-07-14 04:36:20 PDT --- https://github.com/D-Programming-Language/dmd/pull/250 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 22, 2011 [Issue 2245] Bug with overloaded, mixin template functions in classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2245 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2011-07-22 15:12:47 PDT --- https://github.com/D-Programming-Language/dmd/commit/21b96d9ce33b78330f989c624f086f9f0db1dcb1 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 22, 2011 [Issue 2245] Bug with overloaded, mixin template functions in classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2245 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation