* parser.c (add_implicit_template_parms): Set the canonical type of a
        generic parameter to be that of the newly generated type such that it is
        unique.
---
 gcc/cp/parser.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7e9ade2..148e2f2 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -29005,6 +29005,9 @@ add_implicit_template_parms (cp_parser *parser, size_t 
expect_count,
        cur_type = cp_build_qualified_type (new_type, TYPE_QUALS (cur_type));
       else
        cur_type = new_type;
+
+      /* Make the canonical type of the parameter distinct.  */
+      TYPE_CANONICAL (TREE_TYPE (TREE_VALUE (p))) = cur_type;
     }
 
   gcc_assert (synth_count == expect_count);
-- 
1.8.4

Reply via email to