]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/59268 ([c++11] ICE with constexpr in a virtual function)
authorJakub Jelinek <jakub@redhat.com>
Wed, 4 Dec 2013 18:00:28 +0000 (19:00 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 4 Dec 2013 18:00:28 +0000 (19:00 +0100)
PR c++/59268
* pt.c (tsubst_copy_and_build): Handle POINTER_PLUS_EXPR.

* g++.dg/cpp0x/constexpr-template6.C: New test.

From-SVN: r205674

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-template6.C [new file with mode: 0644]

index e2fc2a2d125b987b9933c0ea072c8b8023a95f15..119f309b15c1b422d8ecdd62f393b0d89e9c2841 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/59268
+       * pt.c (tsubst_copy_and_build): Handle POINTER_PLUS_EXPR.
+
 2013-11-29  Marek Polacek  <polacek@redhat.com>
 
        PR sanitizer/59331
index b58c7556e2eaa8b2d0d0d896a39b1b29079d5823..25d940c695a1c2e2752260751b7011b0821e47cc 100644 (file)
@@ -14159,6 +14159,10 @@ tsubst_copy_and_build (tree t,
        RETURN (r);
       }
 
+    case POINTER_PLUS_EXPR:
+      return fold_build_pointer_plus (RECUR (TREE_OPERAND (t, 0)),
+                                     RECUR (TREE_OPERAND (t, 1)));
+
     case SCOPE_REF:
       RETURN (tsubst_qualified_id (t, args, complain, in_decl, /*done=*/true,
                                  /*address_p=*/false));
index 3fe3212dd73d5a6e589016cfafc36afc5d529a4a..b2331560b24fb991f41d9aa5c0adeafff2b15dc3 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/59268
+       * g++.dg/cpp0x/constexpr-template6.C: New test.
+
 2013-12-04  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/pack19.adb: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-template6.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-template6.C
new file mode 100644 (file)
index 0000000..eac6004
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/59268
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+template <typename>
+struct A
+{
+  constexpr A (int) {}
+  virtual void foo ()
+  {
+    constexpr A<void> a (0);
+  }
+};
+
+void
+bar ()
+{
+  A<int> a (3);
+  a.foo ();
+}