From a2aa3e0efc4539b9432b0186f794815a79feba8a Mon Sep 17 00:00:00 2001 From: mmitchel Date: Mon, 10 Mar 2003 07:26:34 +0000 Subject: PR c++/9373 * g++.dg/opt/ptrmem2.C: New test. PR c++/9373 * cp-lang.c (cxx_get_alias_set): Use alias set zero for pointers to member functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64070 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/cp-lang.c | 10 ++++++++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/opt/ptrmem2.C | 12 ++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/ptrmem2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 257673fd205..72dcb9dc3a6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2003-03-09 Mark Mitchell + PR c++/9373 + * cp-lang.c (cxx_get_alias_set): Use alias set zero for + pointers to member functions. + PR c++/8534 * decl.c (build_ptrmemfunc_type): Do not allow default arugments in pointer-to-member-function types. diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 3671027ebe6..b35c31c0763 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -262,8 +262,14 @@ ok_to_generate_alias_set_for_type (tree t) static HOST_WIDE_INT cxx_get_alias_set (tree t) { - /* It's not yet safe to use alias sets for classes in C++. */ - if (!ok_to_generate_alias_set_for_type(t)) + + if (/* It's not yet safe to use alias sets for some classes in C++. */ + !ok_to_generate_alias_set_for_type (t) + /* Nor is it safe to use alias sets for pointers-to-member + functions, due to the fact that there may be more than one + RECORD_TYPE type corresponding to the same pointer-to-member + type. */ + || TYPE_PTRMEMFUNC_P (t)) return 0; return c_common_get_alias_set (t); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 517f3b4193c..976ce7d5d37 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2003-03-09 Mark Mitchell + PR c++/9373 + * g++.dg/opt/ptrmem2.C: New test. + PR c++/8534 * g++.dg/opt/ptrmem1.C: New test. diff --git a/gcc/testsuite/g++.dg/opt/ptrmem2.C b/gcc/testsuite/g++.dg/opt/ptrmem2.C new file mode 100644 index 00000000000..19c43f7cd1f --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/ptrmem2.C @@ -0,0 +1,12 @@ +typedef unsigned int Mword; +struct Thread +{ + Mword sys_ipc_log(); + void hook_ipc_vector(); + unsigned (Thread::*syscall_table)(); +}; + +void Thread::hook_ipc_vector() +{ + syscall_table = &Thread::sys_ipc_log; +} -- cgit v1.2.1