This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Casting of a local pointer-to-member variable



As per ISO/IEC 14882:1998(E) 5.3.1.3 show &(qualified-id) does not form
an expresion of the type "pointer to member", but compiler does not warn 
about it.

The following patch fixes this problem. Please let me know it is okay to 
apply.

Thanks
Chandra

        * semantics.c (finish_parenthesized_expr): Call resolve_offset_ref()
        to give appropriate error message if the qualified_id of a
        pointer-to-member is enclosed in parenthesis.                   

Index: semantics.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/semantics.c,v
retrieving revision 1.191
diff -p -r1.191 semantics.c
*** semantics.c	2001/02/18 05:59:45	1.191
--- semantics.c	2001/02/28 17:49:40
*************** finish_parenthesized_expr (expr)
*** 1239,1245 ****
    if (TREE_CODE (expr) == OFFSET_REF)
      /* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be
         enclosed in parentheses.  */
!     PTRMEM_OK_P (expr) = 0;
    return expr;
  }
  
--- 1239,1248 ----
    if (TREE_CODE (expr) == OFFSET_REF)
      /* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be
         enclosed in parentheses.  */
!     {
!       PTRMEM_OK_P (expr) = 0;
!       resolve_offset_ref (expr);
!     }
    return expr;
  }
  




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]