aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2008-09-05 17:04:12 +0000
committerDoug Gregor <dgregor@gcc.gnu.org>2008-09-05 17:04:12 +0000
commit7aa4a1dfa98e1368ba4cb05b5bd19f9c96def4fb (patch)
tree0d3758b38d9d3094da6d985f0291afcca7771e37 /gcc/cp/tree.c
parent37fbe8a344b5ab7e3e77499176d0581e4187929c (diff)
downloadgcc-7aa4a1dfa98e1368ba4cb05b5bd19f9c96def4fb.zip
gcc-7aa4a1dfa98e1368ba4cb05b5bd19f9c96def4fb.tar.gz
gcc-7aa4a1dfa98e1368ba4cb05b5bd19f9c96def4fb.tar.bz2
re PR c++/37342 (same canonical type node for different types void (Asm::*)(std::ostream&) and void (Asm::* const)(std::ostream&))
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. From-SVN: r140037
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index f9df932..9126763 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;
}