Commit 2d637547 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/21681 (ICE with nested types in template)

cp:
	PR c++/21681
	* parser.c (cp_parser_late_parsing_for_member): Disable access
	checking for template functions.
testsuite:
	PR c++/21681
	* g++.dg/parse/template16.C: New.

From-SVN: r100252
parent a0ef884f
2005-05-27 Nathan Sidwell <nathan@codesourcery.com>
PR c++/21681
* parser.c (cp_parser_late_parsing_for_member): Disable access
checking for template functions.
2005-05-26 Volker Reichelt <reichelt@igpm.rwth-aachen.de> 2005-05-26 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/21768 PR c++/21768
......
...@@ -15486,6 +15486,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) ...@@ -15486,6 +15486,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
if (function_scope) if (function_scope)
push_function_context_to (function_scope); push_function_context_to (function_scope);
/* Push the body of the function onto the lexer stack. */ /* Push the body of the function onto the lexer stack. */
cp_parser_push_lexer_for_tokens (parser, tokens); cp_parser_push_lexer_for_tokens (parser, tokens);
...@@ -15494,10 +15495,17 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) ...@@ -15494,10 +15495,17 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
start_preparsed_function (member_function, NULL_TREE, start_preparsed_function (member_function, NULL_TREE,
SF_PRE_PARSED | SF_INCLASS_INLINE); SF_PRE_PARSED | SF_INCLASS_INLINE);
/* Don't do access checking if it is a templated function. */
if (processing_template_decl)
push_deferring_access_checks (dk_no_check);
/* Now, parse the body of the function. */ /* Now, parse the body of the function. */
cp_parser_function_definition_after_declarator (parser, cp_parser_function_definition_after_declarator (parser,
/*inline_p=*/true); /*inline_p=*/true);
if (processing_template_decl)
pop_deferring_access_checks ();
/* Leave the scope of the containing function. */ /* Leave the scope of the containing function. */
if (function_scope) if (function_scope)
pop_function_context_from (function_scope); pop_function_context_from (function_scope);
......
2005-05-27 Nathan Sidwell <nathan@codesourcery.com>
PR c++/21681
* g++.dg/parse/template16.C: New.
2005-05-27 Andreas Jaeger <aj@suse.de> 2005-05-27 Andreas Jaeger <aj@suse.de>
* gcc.dg/setjmp-2.c: Only run in 32-bit. * gcc.dg/setjmp-2.c: Only run in 32-bit.
......
// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 May 2005 <nathan@codesourcery.com>
// Origin:Volker Reichelt reichelt@gcc.gnu.org
// PR 21681. ICE with inappropriate access check.
template<int X> struct A;
struct B
{
template<int N> void foo()
{
A<N>::X::Y;
}
};
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