aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-10-29 00:17:10 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-10-29 00:17:10 +0000
commit8259e4f5bd121089d8e59d70ee5ab97cddce1e34 (patch)
tree4115879b2c6cd80de5cd4b87ab2e46c0ae0e989e /gcc
parenta9077d27daa2ebe96daf2caf526d94d1cff3a196 (diff)
downloadgcc-8259e4f5bd121089d8e59d70ee5ab97cddce1e34.zip
gcc-8259e4f5bd121089d8e59d70ee5ab97cddce1e34.tar.gz
gcc-8259e4f5bd121089d8e59d70ee5ab97cddce1e34.tar.bz2
re PR c++/30659 (ICE in undefined template)
cp/ 2007-10-28 Paolo Carlini <pcarlini@suse.de> Mark Mitchell <mark@codesourcery.com> PR c++/30659 * pt.c (do_decl_instantiation): If the VAR_DECL is not a class member error out and return. testsuite/ 2007-10-28 Paolo Carlini <pcarlini@suse.de> Mark Mitchell <mark@codesourcery.com> PR c++/30659 * g++.dg/template/crash71.C: New. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r129710
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/template/crash71.C3
4 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2857d4b..8e2323b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2007-10-28 Paolo Carlini <pcarlini@suse.de>
+ Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/30659
+ * pt.c (do_decl_instantiation): If the VAR_DECL is not a
+ class member error out and return.
+
2007-10-27 Jakub Jelinek <jakub@redhat.com>
* error.c (reinit_cxx_pp): Initialize cxx_pp->enclosing_scope
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9193f48..3e8f6e5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13882,6 +13882,11 @@ do_decl_instantiation (tree decl, tree storage)
VAR_DECLs so we do the lookup here. Probably, grokdeclarator
should handle VAR_DECLs as it currently handles
FUNCTION_DECLs. */
+ if (!DECL_CLASS_SCOPE_P (decl))
+ {
+ error ("%qD is not a static data member of a class template", decl);
+ return;
+ }
result = lookup_field (DECL_CONTEXT (decl), DECL_NAME (decl), 0, false);
if (!result || TREE_CODE (result) != VAR_DECL)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 66168c7..cecd5f0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-28 Paolo Carlini <pcarlini@suse.de>
+ Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/30659
+ * g++.dg/template/crash71.C: New.
+
2007-10-28 Tobias Schlüter <tobi@gcc.gnu.org>
PR fortran/32147
diff --git a/gcc/testsuite/g++.dg/template/crash71.C b/gcc/testsuite/g++.dg/template/crash71.C
new file mode 100644
index 0000000..86aa152
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash71.C
@@ -0,0 +1,3 @@
+// PR c++/30659
+
+extern "C" template A<char> foo(); // { dg-error "forbids|static data|expected" }