OSDN Git Service

cp:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Aug 2005 09:06:45 +0000 (09:06 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Aug 2005 09:06:45 +0000 (09:06 +0000)
PR c++/20817
* typeck.c (build_x_unary_op): Make sure OFFSET_REF is not for a
->*.
testsuite:
PR c++/20817
* g++.old-deja/g++.benjamin/13908.C: Robustify expected error.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103481 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.benjamin/13908.C

index 75c4500..db7443b 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-25  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/20817
+       * typeck.c (build_x_unary_op): Make sure OFFSET_REF is not for a
+       ->*.
+
 2005-08-24  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/22454
index 3a3bbea..a052ed1 100644 (file)
@@ -3615,11 +3615,13 @@ build_x_unary_op (enum tree_code code, tree xarg)
       if (!flag_ms_extensions && TREE_CODE (TREE_TYPE (xarg)) == METHOD_TYPE
          && (TREE_CODE (xarg) != OFFSET_REF || !PTRMEM_OK_P (xarg)))
        {
-         if (TREE_CODE (xarg) != OFFSET_REF)
+         if (TREE_CODE (xarg) != OFFSET_REF
+             || !TYPE_P (TREE_OPERAND (xarg, 0)))
            {
-             error ("invalid use of %qE to form a pointer-to-member-function."
-                    "  Use a qualified-id.",
+             error ("invalid use of %qE to form a pointer-to-member-function",
                     xarg);
+             if (TREE_CODE (xarg) != OFFSET_REF)
+               inform ("  a qualified-id is required");
              return error_mark_node;
            }
          else
index cd84c80..dc238f7 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-25  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/20817
+       * g++.old-deja/g++.benjamin/13908.C: Robustify expected error.
+
 2005-08-25  Alan Modra  <amodra@bigpond.net.au>
 
        * gcc.dg/vect/vect-52.c: Increase b[] and c[] size by one.
index e265562..d18434e 100644 (file)
@@ -17,5 +17,5 @@ void bar (chile* pobj, pmf pmethod)
 {
   //-edg: expected member name
   //-g++: taking address of bound pointer-to-member expression
-  foo = (void*) &(pobj->*pmethod);  // { dg-error "" } 
+  foo = (void*) &(pobj->*pmethod);  // { dg-error "invalid use" } 
 }