summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-05 17:04:12 +0000
committerdgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-05 17:04:12 +0000
commitcdc6ffd9cee23cf7bbb0f495e1135d31cf055c0f (patch)
tree0d3758b38d9d3094da6d985f0291afcca7771e37
parente0488d878ea990a9ab2811f357cd8bacef02aa57 (diff)
downloadgcc-cdc6ffd9cee23cf7bbb0f495e1135d31cf055c0f.tar.gz
2008-09-05 Douglas Gregor <doug.gregor@gmail.com>
PR c++/37342 * tree.c (cp_build_qualified_type_real): Deal with sharing of TYPE_LANG_SPECIFIC in the canonical types of pointer-to-method types. 2008-09-05 Douglas Gregor <doug.gregor@gmail.com> PR c++/37342 * g++.dg/other/canon-37342.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140037 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/tree.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/canon-37342.C8
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 09091cc8d2e..cb5c31402e8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-05 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/37342
+ * tree.c (cp_build_qualified_type_real): Deal with sharing of
+ TYPE_LANG_SPECIFIC in the canonical types of pointer-to-method
+ types.
+
2008-09-04 Ian Lance Taylor <iant@google.com>
* parser.c (check_no_duplicate_clause): Change code parameter to
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index f9df932221f..912676393d0 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -877,6 +877,17 @@ cp_build_qualified_type_real (tree type,
&& TYPE_LANG_SPECIFIC (result) == TYPE_LANG_SPECIFIC (type))
TYPE_LANG_SPECIFIC (result) = NULL;
+ /* We may also have ended up building a new copy of the canonical
+ type of a pointer-to-method type, which could have the same
+ sharing problem described above. */
+ if (TYPE_CANONICAL (result) != TYPE_CANONICAL (type)
+ && TREE_CODE (type) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE
+ && (TYPE_LANG_SPECIFIC (TYPE_CANONICAL (result))
+ == TYPE_LANG_SPECIFIC (TYPE_CANONICAL (type))))
+ TYPE_LANG_SPECIFIC (TYPE_CANONICAL (result)) = NULL;
+
+
return result;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3278cedb2ed..eb9da58da56 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-05 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/37342
+ * g++.dg/other/canon-37342.C: New.
+
2008-09-05 Joseph Myers <joseph@codesourcery.com>
* gcc.c-torture/compile/20080903-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/other/canon-37342.C b/gcc/testsuite/g++.dg/other/canon-37342.C
new file mode 100644
index 00000000000..dd96e40ebd2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/canon-37342.C
@@ -0,0 +1,8 @@
+class Asm;
+template<typename _CharT> class basic_ostream;
+typedef basic_ostream<char> ostream;
+class Options {
+ typedef void (Asm::* emitfunc_t) (ostream &);
+ emitfunc_t getemit () const { return emitfunc; }
+ emitfunc_t emitfunc;
+};