summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-21 22:18:54 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-21 22:18:54 +0000
commite81de9c8eb33a9dedf33078d08b9815b98acf55d (patch)
treedbd8c52e4a1d7674d3b117a9267ce96b88f30e02
parent9357a254ec6c9694655284a04871f7bb7da82801 (diff)
downloadgcc-e81de9c8eb33a9dedf33078d08b9815b98acf55d.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117123 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/init/ptrfn1.C12
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f6b83bd7894..9661c8f6bc5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 220be7eda86..4713f05809c 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 49ea8251386..80097ac33a5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..0cbabbf8072
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/ptrfn1.C
@@ -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};
+