digitalmars.D.bugs - [Issue 7590] New: no error with missing template parameter
- d-bugmail puremagic.com (37/37) Feb 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7590
- d-bugmail puremagic.com (6/6) Feb 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7590
- d-bugmail puremagic.com (20/21) Feb 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7590
- d-bugmail puremagic.com (11/11) Feb 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7590
http://d.puremagic.com/issues/show_bug.cgi?id=7590 Summary: no error with missing template parameter Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: mrmocool gmx.de --- Comment #0 from Trass3r <mrmocool gmx.de> 2012-02-26 16:34:57 CET --- template curry(alias fun, alias arg) { auto curry(Ts args2) { return fun(arg, args2); } } unittest { static struct TCallable { auto opCall(A, )(A a, B b) { return a + b; } } TCallable tcallable; static assert(!is(typeof(curry!(tcallable, "5")))); } $ dmd -c -unittest test.d -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7590 --- Comment #1 from Trass3r <mrmocool gmx.de> 2012-02-26 16:35:38 CET --- NB: The problem is B isn't defined. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7590 --- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2012-02-26 07:57:46 PST --- D parser simply ignores almost of unnecessary last comma in list like follows. enum E { A = 0, B, C, } // last comma is ignored void func(int x, int y, ){} // last comma is ignored //template X((T, U, ){} // this cannot pass parsing... void tfunc(A, B, )(A, B){}; // last comma is ignored void main() { func(1,2); // func has two parameters tfunc(1,2); // tfunc has two parameters } Then,auto opCall(A, )(A a, B b)in struct TCallable is valid template function declaration, same as auto opCall(A)(A a, B b) But B is undefined identifier, so its instantiation fails inside is(typeof(...)). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7590 Trass3r <mrmocool gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #3 from Trass3r <mrmocool gmx.de> 2012-02-26 17:50:30 CET --- Ah yep, forgot that the error is gagged. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2012