summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-06-06 15:42:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-06-06 15:42:38 -0400
commita651bcbe5e945d5e6f4f9597b400040bed984460 (patch)
tree20c63c275e104aef2fceb40d5a70bb2a7680e8c6
parent4de4b0f267380846df53edeea0afdcb383fd4d8f (diff)
downloadgcc-a651bcbe5e945d5e6f4f9597b400040bed984460.tar.gz
re PR c++/49298 ([C++0x] sorry, unimplemented: unexpected ast of kind field_decl)
PR c++/49298 * semantics.c (potential_constant_expression_1): Handle FIELD_DECL. From-SVN: r174721
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C9
4 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9d0b8f0d9f8..dbe6ffbc555 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2011-06-06 Jason Merrill <jason@redhat.com>
+ PR c++/49298
+ * semantics.c (potential_constant_expression_1): Handle FIELD_DECL.
+
PR objc++/49221
* decl.c (cp_finish_decl): Check DECL_FUNCTION_SCOPE_P rather than
at_function_scope_p.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ca9cf4bd130..ebca840ea2e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7489,6 +7489,8 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
case TEMPLATE_PARM_INDEX:
case TRAIT_EXPR:
case IDENTIFIER_NODE:
+ /* We can see a FIELD_DECL in a pointer-to-member expression. */
+ case FIELD_DECL:
return true;
case PARM_DECL:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 761935012ab..7d9a9c2ef9f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-06-06 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/regress/ptrmem1.C: New.
+
2011-06-06 Richard Sandiford <rdsandiford@googlemail.com>
PR rtl-optimization/49145
diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C b/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C
new file mode 100644
index 00000000000..873000b9c38
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C
@@ -0,0 +1,9 @@
+// PR c++/49298
+// { dg-options -std=c++0x }
+
+template <class T, int T::*> struct B { };
+template <class T> struct A
+{
+ int i;
+ B<A,&A::i> b;
+};