diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2005-05-27 14:23:47 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-05-27 14:23:47 +0000 |
commit | 2d63754709c889b1087e692b6124e0ed9fc00a8b (patch) | |
tree | 4a34200c877704b6f8d086c4ee4600ed409e379b /gcc | |
parent | a0ef884f73d791abd09ca3f5a9ccf725ead5fe39 (diff) | |
download | gcc-2d63754709c889b1087e692b6124e0ed9fc00a8b.zip gcc-2d63754709c889b1087e692b6124e0ed9fc00a8b.tar.gz gcc-2d63754709c889b1087e692b6124e0ed9fc00a8b.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/template16.C | 15 |
4 files changed, 34 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1fde495..6f29005 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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> PR c++/21768 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a0d71b3..7f39c91 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -15486,6 +15486,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) if (function_scope) push_function_context_to (function_scope); + /* Push the body of the function onto the lexer stack. */ cp_parser_push_lexer_for_tokens (parser, tokens); @@ -15494,10 +15495,17 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) start_preparsed_function (member_function, NULL_TREE, 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. */ cp_parser_function_definition_after_declarator (parser, /*inline_p=*/true); + if (processing_template_decl) + pop_deferring_access_checks (); + /* Leave the scope of the containing function. */ if (function_scope) pop_function_context_from (function_scope); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a114bdb..c424bf5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> * gcc.dg/setjmp-2.c: Only run in 32-bit. diff --git a/gcc/testsuite/g++.dg/parse/template16.C b/gcc/testsuite/g++.dg/parse/template16.C new file mode 100644 index 0000000..bc41b0f --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/template16.C @@ -0,0 +1,15 @@ +// 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; + } +}; |