aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-08-27 17:45:25 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2006-08-27 17:45:25 +0000
commit99f4234aa713145f873b2295a4d62dd388489e64 (patch)
tree61cd571210dd2a9eb140c6a82736f3e05ddaac45
parentbf87e098aefb413abaa78ec5e0d37dc7366c2c86 (diff)
downloadgcc-99f4234aa713145f873b2295a4d62dd388489e64.zip
gcc-99f4234aa713145f873b2295a4d62dd388489e64.tar.gz
gcc-99f4234aa713145f873b2295a4d62dd388489e64.tar.bz2
re PR c++/28058 (ICE in inline_forbidden_p)
PR c++/28058 * pt.c (register_specialization): Return error_mark_node for specialization-after-instantiation. * decl2.c (mark_used): Mark the main function used when one of its clones is used. PR c++/28058 * g++.dg/template/spec31.C: New test. From-SVN: r116491
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/spec31.C10
5 files changed, 26 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index dd1df56..369a678 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2006-08-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/28058
+ * pt.c (register_specialization): Return error_mark_node for
+ specialization-after-instantiation.
+ * decl2.c (mark_used): Mark the main function used when one of its
+ clones is used.
+
2006-08-27 Lee Millward <lee.millward@codesourcery.com>
PR c++/26573
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index db1e917..a6187e2 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3494,6 +3494,8 @@ mark_used (tree decl)
}
TREE_USED (decl) = 1;
+ if (DECL_CLONED_FUNCTION_P (decl))
+ TREE_USED (DECL_CLONED_FUNCTION (decl)) = 1;
/* If we don't need a value, then we don't need to synthesize DECL. */
if (skip_evaluation)
return;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 5e0c954..17557c0 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1163,7 +1163,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
{
error ("specialization of %qD after instantiation",
fn);
- return spec;
+ return error_mark_node;
}
else
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c6d6457..dd2456b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/28058
+ * g++.dg/template/spec31.C: New test.
+
2006-08-27 Lee Millward <lee.millward@codesourcery.com>
PR c++/26573
diff --git a/gcc/testsuite/g++.dg/template/spec31.C b/gcc/testsuite/g++.dg/template/spec31.C
new file mode 100644
index 0000000..3b36ab4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/spec31.C
@@ -0,0 +1,10 @@
+// PR c++/28058
+
+template<int> struct A
+{
+ A() {}
+};
+
+A<0> a;
+
+template<> A<0>::A() {} // { dg-error "specialization" }