aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-07-04 17:34:07 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-07-04 17:34:07 -0400
commitfece06368cf6ebfc99558ae612c0cf53d2e2e5aa (patch)
treed9ce17d6b129ac57b13f55210b42f90431fc0ce8
parent3f1ae7424c7600eb1033e871d6095a5fe3f81555 (diff)
downloadgcc-fece06368cf6ebfc99558ae612c0cf53d2e2e5aa.zip
gcc-fece06368cf6ebfc99558ae612c0cf53d2e2e5aa.tar.gz
gcc-fece06368cf6ebfc99558ae612c0cf53d2e2e5aa.tar.bz2
re PR c++/53848 (ICE in decl_linkage at ../../gcc-trunk/gcc/cp/tree.c:3215)
PR c++/53848 * decl.c (build_enumerator): Don't use build_lang_decl_loc. From-SVN: r189267
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/enum3.C10
4 files changed, 22 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0b3adaf..e11b240 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/53848
+ PR c++/53524
+ * decl.c (build_enumerator): Don't use build_lang_decl_loc.
+
2012-07-03 Jakub Jelinek <jakub@redhat.com>
PR c++/53812
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 18beaa9..6c0990c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12561,14 +12561,7 @@ incremented enumerator value is too large for %<long%>");
course, if we're processing a template, there may be no value. */
type = value ? TREE_TYPE (value) : NULL_TREE;
- if (context && context == current_class_type)
- /* This enum declaration is local to the class. We need the full
- lang_decl so that we can record DECL_CLASS_CONTEXT, for example. */
- decl = build_lang_decl_loc (loc, CONST_DECL, name, type);
- else
- /* It's a global enum, or it's local to a function. (Note local to
- a function could mean local to a class method. */
- decl = build_decl (loc, CONST_DECL, name, type);
+ decl = build_decl (loc, CONST_DECL, name, type);
DECL_CONTEXT (decl) = enumtype;
TREE_CONSTANT (decl) = 1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2833385..cdeac30 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/53848
+ * g++.dg/other/enum3.C: New.
+
2012-07-04 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/53321
diff --git a/gcc/testsuite/g++.dg/other/enum3.C b/gcc/testsuite/g++.dg/other/enum3.C
new file mode 100644
index 0000000..23d6c83
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/enum3.C
@@ -0,0 +1,10 @@
+// PR c++/53848
+
+extern "C"
+{
+ struct s {
+ enum {
+ e = 0
+ } f;
+ };
+}