commit a07ee89ff40f73dcb1fc11fb66931ee79bf8a2d9
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jun 6 12:05:39 2011 -0400
PR c++/49298
* semantics.c (potential_constant_expression_1): Handle FIELD_DECL.
@@ -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:
new file mode 100644
@@ -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;
+};