aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-06-29 11:10:11 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-06-29 11:10:11 +0000
commitfe88415f1b385b2dfc11f54422ff414f643df9e0 (patch)
tree8def500d734e8c86faa6708912a0e710a0d4154c
parent962fe3950f5130476f665b08be7db6b5552e8a3b (diff)
downloadgcc-fe88415f1b385b2dfc11f54422ff414f643df9e0.zip
gcc-fe88415f1b385b2dfc11f54422ff414f643df9e0.tar.gz
gcc-fe88415f1b385b2dfc11f54422ff414f643df9e0.tar.bz2
re PR c++/16260 (ICE in template function)
cp: PR c++/16260 * parser.c (cp_parser_template_declaration_after_export): Disable access checks here ... (cp_parser_class_specifier): ... not here. testsuite: PR c++/16260 * g++.dg/parse/crash15.C: New. From-SVN: r83851
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/parser.c14
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/parse/crash15.C9
4 files changed, 29 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ad782f2..532180d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2004-06-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/16260
+ * parser.c (cp_parser_template_declaration_after_export): Disable
+ access checks here ...
+ (cp_parser_class_specifier): ... not here.
+
2004-06-28 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK,
@@ -19,7 +26,7 @@
2004-06-28 Nathan Sidwell <nathan@codesourcery.com>
- PR C++/16174
+ PR c++/16174
* call.c (build_temp): Declare.
(check_constructor_callable): New.
(reference_binding): Only set CHECK_COPY_CONSTRUCTOR if not for
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 10238c4..ca2b0a9 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -12343,11 +12343,6 @@ cp_parser_class_specifier (cp_parser* parser)
pop_p = push_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type)));
type = begin_class_definition (type);
- if (processing_template_decl)
- /* There are no access checks when parsing a template, as we do no
- know if a specialization will be a friend. */
- push_deferring_access_checks (dk_no_check);
-
if (type == error_mark_node)
/* If the type is erroneous, skip the entire body of the class. */
cp_parser_skip_to_closing_brace (parser);
@@ -12355,9 +12350,6 @@ cp_parser_class_specifier (cp_parser* parser)
/* Parse the member-specification. */
cp_parser_member_specification_opt (parser);
- if (processing_template_decl)
- pop_deferring_access_checks ();
-
/* Look for the trailing `}'. */
cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
/* We get better error messages by noticing a common problem: a
@@ -14879,10 +14871,16 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
cp_parser_template_declaration_after_export (parser, member_p);
else
{
+ /* There are no access checks when parsing a template, as we do not
+ know if a specialization will be a friend. */
+ push_deferring_access_checks (dk_no_check);
+
decl = cp_parser_single_declaration (parser,
member_p,
&friend_p);
+ pop_deferring_access_checks ();
+
/* If this is a member template declaration, let the front
end know. */
if (member_p && !friend_p && decl)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bff0e80..3fe71ec 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/16260
+ * g++.dg/parse/crash15.C: New.
+
2004-06-28 Andrew Pinski <apinski@apple.com>
* gcc.dg/pr14963.c: Remove the dg-warning as it is dected
@@ -12,7 +17,7 @@
2004-06-28 Nathan Sidwell <nathan@codesourcery.com>
- * PR C++/16174
+ * PR c++/16174
* g++.dg/template/ctor4.C: New.
2004-06-27 Andrew Pinski <pinskia@physics.uc.edu>
diff --git a/gcc/testsuite/g++.dg/parse/crash15.C b/gcc/testsuite/g++.dg/parse/crash15.C
new file mode 100644
index 0000000..afad4c1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash15.C
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Jun 2004 <nathan@codesourcery.com>
+
+// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
+// Bug 16260. ICE
+
+template<typename T> int foo() { return T::X::Y; }