Ian Lance Taylor <[EMAIL PROTECTED]> writes: > Alan Mackenzie <[EMAIL PROTECTED]> writes: > >> I'm thinking of things like >> >> foo (a < b, c > d); >> >> I think this is unambiguously a function call with 2 parameters, the >> expressions "a < b" and "c > d". It cannot be be one with 1 parameter >> beginning with the template invocation "a < b , c >". Or can it? > > No, it can't be, because a<b, c> is a type. The result would be > foo(TYPE d), which can not be a function call. On the other hand, if > there were a type before foo then this would be a function > declaration. For example, this is valid C++ code: > > template <int a1, int a2> class a; > > int fn(int d, int e) > { > const int b = 1; > const int c = 2; > typedef int f; > f foo (int, int); > f foo (a < b, c > d); > foo (e < b, c > d); > } > > The line "f foo (a < b, c > d);" uses a template, the line "foo (e < > b, c > d);" does not.
Oh, wait, I forgot about constructors. This is valid C++ code: template <int a1, int a2> class a; const int b = 1; const int c = 2; int d; int e; class foo { foo (a < b, c > d); }; extern void quux (int, int); void bar() { quux (e < b, c > d); } Inside the class foo, you've got a template, inside the function bar, you've got a function call. I think you're going to have a hard time with this. Ian