re PR c++/29016 (tree check: expected class 'expression', have 'exceptional' (baselin...
authorMark Mitchell <mark@codesourcery.com>
Thu, 21 Sep 2006 22:18:54 +0000 (22:18 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 21 Sep 2006 22:18:54 +0000 (22:18 +0000)
PR c++/29016
* typeck.c (build_unary_op): Don't form an ADDR_EXPR around a
BASELINK.
PR c++/29016
* g++.dg/init/ptrfn1.C: New test.

From-SVN: r117123

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/ptrfn1.C [new file with mode: 0644]

index f6b83bd7894563f9cdfe8dc1f7baf35142a9cd41..9661c8f6bc5003ce2364fd6c4fccde172df119e9 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-21  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/29016
+       * typeck.c (build_unary_op): Don't form an ADDR_EXPR around a
+       BASELINK.
+
 2006-09-21  Lee Millward  <lee.millward@codesourcery.com>
 
        PR c++/28861
index 220be7eda864258fd638a94ef616625e0849ae43..4713f05809c9bec41a3d91400cca9f2ba1c44797 100644 (file)
@@ -4311,6 +4311,10 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
            pedwarn ("ISO C++ forbids taking the address of a cast to a non-lvalue expression");
          break;
 
+       case BASELINK:
+         arg = BASELINK_FUNCTIONS (arg);
+         /* Fall through.  */
+
        case OVERLOAD:
          arg = OVL_CURRENT (arg);
          break;
index 49ea82513864ef4545bd880f0df1225844b05ae7..80097ac33a51592193ca3e0d24f00785bdf07898 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-21  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/29016
+       * g++.dg/init/ptrfn1.C: New test.
+
 2006-09-21  Lee Millward  <lee.millward@codesourcery.com>
 
         PR c++/28861
diff --git a/gcc/testsuite/g++.dg/init/ptrfn1.C b/gcc/testsuite/g++.dg/init/ptrfn1.C
new file mode 100644 (file)
index 0000000..0cbabbf
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/29016
+// { dg-options "-O2" }
+
+class A;
+class B
+{
+  typedef void (*C[5]) (A *);
+  static  C D;
+  static void E (A*) {}
+};
+B::C B::D={E};
+