aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-04-06 09:25:45 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-04-06 09:25:45 -0400
commitc5c8755af05d474f2cb4c412207f20e5642b12b2 (patch)
tree3a2d916335d803f774bf56155dce5907ba581b68
parentb258592a08389223dd89ba0f31384f2adf9906c4 (diff)
downloadgcc-c5c8755af05d474f2cb4c412207f20e5642b12b2.zip
gcc-c5c8755af05d474f2cb4c412207f20e5642b12b2.tar.gz
gcc-c5c8755af05d474f2cb4c412207f20e5642b12b2.tar.bz2
re PR c++/52596 ([C++11] internal compiler error: in lvalue_kind, at cp/tree.c:153)
PR c++/52596 * semantics.c (finish_non_static_data_member): In templates, pass the decl to build_qualified_name. * tree.c (lvalue_kind) [SCOPE_REF]: Handle FIELD_DECL. From-SVN: r186187
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/tree.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/qualified-id5.C17
5 files changed, 38 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1b93ecd..78c4369 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2012-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/52596
+ * semantics.c (finish_non_static_data_member): In templates, pass
+ the decl to build_qualified_name.
+ * tree.c (lvalue_kind) [SCOPE_REF]: Handle FIELD_DECL.
+
2012-04-04 Jason Merrill <jason@redhat.com>
PR c++/52845
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 65b771f..9bdd2ee 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1590,7 +1590,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
else if (processing_template_decl)
return build_qualified_name (TREE_TYPE (decl),
qualifying_scope,
- DECL_NAME (decl),
+ decl,
/*template_p=*/false);
else
{
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 30ad5e1..0577759 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -151,8 +151,14 @@ lvalue_kind (const_tree ref)
/* A scope ref in a template, left as SCOPE_REF to support later
access checking. */
case SCOPE_REF:
- gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE(ref)));
- return lvalue_kind (TREE_OPERAND (ref, 1));
+ gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE (ref)));
+ {
+ tree op = TREE_OPERAND (ref, 1);
+ if (TREE_CODE (op) == FIELD_DECL)
+ return (DECL_C_BIT_FIELD (op) ? clk_bitfield : clk_ordinary);
+ else
+ return lvalue_kind (op);
+ }
case MAX_EXPR:
case MIN_EXPR:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cde30ef..946f02e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/52596
+ * g++.dg/template/qualified-id5.C: New.
+
2012-04-05 Uros Bizjak <ubizjak@gmail.com>
PR target/52882
diff --git a/gcc/testsuite/g++.dg/template/qualified-id5.C b/gcc/testsuite/g++.dg/template/qualified-id5.C
new file mode 100644
index 0000000..3126d33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/qualified-id5.C
@@ -0,0 +1,17 @@
+// PR c++/52596
+
+struct msgpack_zone_finalizer_array {
+ int* tail;
+};
+struct msgpack_zone {
+ msgpack_zone_finalizer_array finalizer_array;
+};
+struct zone : public msgpack_zone {
+ template <typename T> T* allocate();
+
+};
+template <typename T>
+T* zone::allocate()
+{
+ --msgpack_zone::finalizer_array.tail;
+}