===================================================================
@@ -7423,6 +7423,9 @@ build_ptrmemfunc_type (tree type)
tree
build_ptrmem_type (tree class_type, tree member_type)
{
+ if (TREE_CODE (class_type) == FUNCTION_DECL
+ || TREE_CODE (class_type) == VAR_DECL)
+ class_type = TREE_TYPE (class_type);
if (TREE_CODE (member_type) == METHOD_TYPE)
{
cp_cv_quals quals = type_memfn_quals (member_type);
===================================================================
@@ -4859,11 +4859,12 @@ cp_build_addr_expr_1 (tree arg, bool str
offset_ref:
/* Turn a reference to a non-static data member into a
pointer-to-member. */
+
{
tree type;
tree t;
- gcc_assert (PTRMEM_OK_P (arg));
+ gcc_assert (PTRMEM_OK_P (arg) || flag_ms_extensions);
t = TREE_OPERAND (arg, 1);
if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
@@ -4878,7 +4879,7 @@ cp_build_addr_expr_1 (tree arg, bool str
t = make_ptrmem_cst (type, TREE_OPERAND (arg, 1));
return t;
}
-
+ /* Fall through. */
default:
break;
}
===================================================================
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fms-extensions" } */
+
+class chile
+{
+ typedef void (chile::* pmf) ();
+ void bar (pmf pmethod)
+ {
+ &(this->*pmethod);
+ }
+};
+
+