------- Comment #3 from  2009-03-01 04:38 -------
The problem here is that S!(int)(42) can be either a template followed by (42),
or a function template with argument list (42). The compiler cannot tell. So
first it tries the former, and it silently fails (due to the wrong_code). Then,
it figures it must be a function template, and tries that. That fails too,
hence the error message you see.

The reason:

S!(int) s = S!(int)(42);

gives a more correct message is the left S!(int) type is compiled first, and by
the syntax the compiler knows it's not a function template, so instead of
silently failing it verbosely fails.

So what to do if both tries at instantiating it fail? Print the first error
message, or the second? One will not make sense.


Reply via email to