Commit 4bfb8bba by Mark Mitchell Committed by Mark Mitchell

re PR c++/13950 ([DR176] lookup of dependent base name)

	PR c++/13950
	* parser.c (cp_parser_class_name): Robustify.

	PR c++/13970
	* parser.c (cp_parser_cache_group): Do not consume the EOF token.

	PR c++/13950
	* g++.dg/template/lookup4.C: New test.

	PR c++/13970
	* g++.dg/parse/error14.C: New test.

From-SVN: r77186
parent a8f0f22e
2004-02-03 Mark Mitchell <mark@codesourcery.com>
PR c++/13950
* parser.c (cp_parser_class_name): Robustify.
PR c++/13970
* parser.c (cp_parser_cache_group): Do not consume the EOF token.
PR c++/14002
* semantics.c (finish_id_expression): Do not return an
IDENTIFIER_NODE when lookup finds a PARM_DECL.
......
......@@ -11622,8 +11622,11 @@ cp_parser_class_name (cp_parser *parser,
/* If this is a typename, create a TYPENAME_TYPE. */
if (typename_p && decl != error_mark_node)
decl = TYPE_NAME (make_typename_type (scope, decl,
/*complain=*/1));
{
decl = make_typename_type (scope, decl, /*complain=*/1);
if (decl != error_mark_node)
decl = TYPE_NAME (decl);
}
/* Check to see that it is really the name of a class. */
if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
......@@ -15069,11 +15072,11 @@ cp_parser_cache_group (cp_parser *parser,
if ((end == CPP_CLOSE_PAREN || depth == 0)
&& cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
return;
/* Consume the next token. */
token = cp_lexer_consume_token (parser->lexer);
/* If we've reached the end of the file, stop. */
if (token->type == CPP_EOF)
if (cp_lexer_next_token_is (parser->lexer, CPP_EOF))
return;
/* Consume the next token. */
token = cp_lexer_consume_token (parser->lexer);
/* Add this token to the tokens we are saving. */
cp_token_cache_push_token (cache, token);
/* See if it starts a new group. */
......
2004-02-03 Mark Mitchell <mark@codesourcery.com>
PR c++/13950
* g++.dg/template/lookup4.C: New test.
PR c++/13970
* g++.dg/parse/error14.C: New test.
PR c++/14002
* g++.dg/parse/template13.C: New test.
......
// PR c++/13970
struct X
{
template< typename Z > Z Zunc()
{
return Z();
}
template< typename Z > void Zinc()
{
}
void tst()
{
Zunc<int>();
Zinc<int>( //);
// }
}; // { dg-error "" }
// PR c++/13950
template <class T> struct Base {};
template <class T> struct Derived: public Base<T> {
typename Derived::template Base<double>* p1; // { dg-error "" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment