re PR c++/49298 ([C++0x] sorry, unimplemented: unexpected ast of kind field_decl)
authorJason Merrill <jason@redhat.com>
Mon, 6 Jun 2011 19:42:38 +0000 (15:42 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 6 Jun 2011 19:42:38 +0000 (15:42 -0400)
PR c++/49298
* semantics.c (potential_constant_expression_1): Handle FIELD_DECL.

From-SVN: r174721

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C [new file with mode: 0644]

index 9d0b8f0d9f85be269063b946b4c5009b7f548ef9..dbe6ffbc555ef4cf96c37a89bf398d686d90b6cd 100644 (file)
@@ -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.
index ca9cf4bd130b2af714a6aa4c547491201ab61786..ebca840ea2e466ac836f4eabb0ba1686c00ef26f 100644 (file)
@@ -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:
index 761935012aba76285387c58120084a4fc2fc4703..7d9a9c2ef9f092cfb8f0a4e48b8d38c75ca50576 100644 (file)
@@ -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 (file)
index 0000000..873000b
--- /dev/null
@@ -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;
+};