On Fri, 6 Feb 2004 14:44:33 +0100, "Giovanni Bajo" <giovannibajo@libero.it> wrote:
the parser accepts invalid code such as:
----------------------------------------------------------
template <int> struct A {};
template <typename TP> class B : public A<4 {}; // missing bracket!
----------------------------------------------------------
This happens because the check is done by cp_parser_require, which does not
emit an error during tentative parsing. The argument list is not invalidated by
this, and a CPP_TEMPLATE_ID is created, so that subsequent (non-tentative)
parsings fail to diagnose the problem. Fixed by forcing a hard error.
I'm not very familiar with this code, but it seems to me that giving a hard
error during tentative parsing isn't right.