[Issue 7590] no error with missing template parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 26 07:57:46 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7590



--- Comment #2 from Kenji Hara <k.hara.pg at 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: -------


More information about the Digitalmars-d-bugs mailing list