]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/21681 (ICE with nested types in template)
authorNathan Sidwell <nathan@codesourcery.com>
Fri, 27 May 2005 14:23:47 +0000 (14:23 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Fri, 27 May 2005 14:23:47 +0000 (14:23 +0000)
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

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/template16.C [new file with mode: 0644]

index 1fde4951d7e78a57174368232bb85038af00963e..6f290053f2789f06de341dd9b491b3e9374e53c6 100644 (file)
@@ -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
index a0d71b3141f9bc3a2a18309191e7dcc2579c7ec9..7f39c91a95a1e7af4fd16b42d125107caaae78a5 100644 (file)
@@ -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);
index a114bdbed4ce5878b767572bd8d0500a6116a023..c424bf5f0a1ceb7ea452ffc2c53f80d4aee38995 100644 (file)
@@ -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 (file)
index 0000000..bc41b0f
--- /dev/null
@@ -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;
+    }
+};
This page took 0.11749 seconds and 5 git commands to generate.