]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/55685 (ICE: canonical types differ for identical types)
authorJason Merrill <jason@redhat.com>
Sat, 15 Dec 2012 04:02:52 +0000 (23:02 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 15 Dec 2012 04:02:52 +0000 (23:02 -0500)
PR c++/55685
* pt.c (tsubst_copy_and_build): Don't use SIZEOF_EXPR_TYPE_P in
templates.

From-SVN: r194517

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/sizeof15.C [new file with mode: 0644]

index ee9bf7749efd98125ff2c0cd9fbe363552aab46c..83d3c63860ce356dcedbc410c0d3db5ca50b50f8 100644 (file)
@@ -1,5 +1,9 @@
 2012-12-14  Jason Merrill  <jason@redhat.com>
 
+       PR c++/55685
+       * pt.c (tsubst_copy_and_build): Don't use SIZEOF_EXPR_TYPE_P in
+       templates.
+
        PR c++/42315
        * decl.c (maybe_deduce_size_from_array_init): Don't change the
        variable type.
index 91450d8540702fa7118c09d33737d6e9f1da3dea..a21522b3510679be1ebad4aa1bc40f9e7092efe6 100644 (file)
@@ -13563,7 +13563,7 @@ tsubst_copy_and_build (tree t,
          {
            if (TREE_CODE (r) != SIZEOF_EXPR || TYPE_P (op1))
              {
-               if (TYPE_P (op1))
+               if (!processing_template_decl && TYPE_P (op1))
                  {
                    r = build_min (SIZEOF_EXPR, size_type_node,
                                   build1 (NOP_EXPR, op1, error_mark_node));
diff --git a/gcc/testsuite/g++.dg/template/sizeof15.C b/gcc/testsuite/g++.dg/template/sizeof15.C
new file mode 100644 (file)
index 0000000..3298dad
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/55685
+
+typedef __SIZE_TYPE__ size_t;
+template <size_t T, size_t U>
+struct A;
+
+template <typename T> struct B
+{
+  static A <sizeof (T), 0> x;
+};
+
+template <typename T>
+A <sizeof (T), 0> B <T>::x;