re PR c++/59268 ([c++11] ICE with constexpr in a virtual function)

PR c++/59268
	* pt.c (tsubst_copy_and_build): Handle POINTER_PLUS_EXPR.

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

From-SVN: r205674
This commit is contained in:
Jakub Jelinek 2013-12-04 19:00:28 +01:00 committed by Jakub Jelinek
parent 3bd7b086fd
commit 565839ae12
4 changed files with 34 additions and 0 deletions

View 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

View 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));

View 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.

View File

@ -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 ();
}