From f092a8668aa6d6a1a1fcc42d1b7e7c690aad598a Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 4 Aug 2006 04:58:36 +0000 Subject: [PATCH] re PR c++/28148 (ICE with pointer to member function initializer and cast to a different type) PR c++/28148 * varasm.c (output_constant): Give the front end another chance to expand constants, after stripping NOPs. PR c++/28148 * g++.dg/init/ptrmem3.C: New test. From-SVN: r115919 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/init/ptrmem3.C | 8 ++++++++ gcc/varasm.c | 3 +++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/init/ptrmem3.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 39e5cfa015f..216b686529b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-08-03 Mark Mitchell + + PR c++/28148 + * varasm.c (output_constant): Give the front end another chance to + expand constants, after stripping NOPs. + 2006-08-03 Jan Hubicka * domwalk.c (walk_dominator_tree): Reorganize to non-recursive diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a2256d5d2cf..a07f7c1c4a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-08-03 Mark Mitchell + + PR c++/28148 + * g++.dg/init/ptrmem3.C: New test. + 2006-08-03 Dorit Nuzman PR tree-optimization/27770 diff --git a/gcc/testsuite/g++.dg/init/ptrmem3.C b/gcc/testsuite/g++.dg/init/ptrmem3.C new file mode 100644 index 00000000000..95b60379b40 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/ptrmem3.C @@ -0,0 +1,8 @@ +// PR c++/28148 + +struct foo { +public: + virtual int bar(int); +}; + +void (foo::*__Virtual__foo__Var1)() = (void (foo::*)())(&foo::bar); diff --git a/gcc/varasm.c b/gcc/varasm.c index 1f5f43a1b4e..9837e0de147 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4048,6 +4048,9 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) code = TREE_CODE (TREE_TYPE (exp)); thissize = int_size_in_bytes (TREE_TYPE (exp)); + /* Give the front end another chance to expand constants. */ + exp = lang_hooks.expand_constant (exp); + /* Allow a constructor with no elements for any data type. This means to fill the space with zeros. */ if (TREE_CODE (exp) == CONSTRUCTOR -- 2.30.2