+2011-12-14 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/51476
+ * pt.c (convert_nontype_argument): Don't call maybe_constant_value
+ for PTRMEM_CST nodes.
+
2011-12-13 Jason Merrill <jason@redhat.com>
PR c++/51406
to a null value, but otherwise still need to be of a specific form. */
if (cxx_dialect >= cxx0x)
{
- if (INTEGRAL_OR_ENUMERATION_TYPE_P (type))
+ if (TREE_CODE (expr) == PTRMEM_CST)
+ /* A PTRMEM_CST is already constant, and a valid template
+ argument for a parameter of pointer to member type, we just want
+ to leave it in that form rather than lower it to a
+ CONSTRUCTOR. */;
+ else if (INTEGRAL_OR_ENUMERATION_TYPE_P (type))
expr = maybe_constant_value (expr);
else if (TYPE_PTR_P (type)
- || (TYPE_PTR_TO_MEMBER_P (type)
- && TREE_CODE (expr) != PTRMEM_CST))
+ || TYPE_PTR_TO_MEMBER_P (type))
{
tree folded = maybe_constant_value (expr);
if (TYPE_PTR_P (type) ? integer_zerop (folded)
--- /dev/null
+// Origin PR c++/51476
+// { dg-options "-std=c++11" }
+
+template<int> struct A {};
+struct B
+{
+ int i;
+ A<&B::i> a; // { dg-error "could not convert template argument" }
+};