Fix instantiation of transaction expressions.

gcc/cp/
	* pt.c (tsubst_copy_and_build): Handle TRANSACTION_EXPR.

	gcc/testsuite/
	* g++.dg/tm/template-2.C: New test.

From-SVN: r181601
This commit is contained in:
Torvald Riegel 2011-11-21 22:29:13 +00:00 committed by Torvald Riegel
parent b0dc7e4c34
commit 1e159409fc
4 changed files with 34 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2011-11-21 Torvald Riegel <triegel@redhat.com>
* pt.c (tsubst_copy_and_build): Handle TRANSACTION_EXPR.
2011-11-21 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/50958

View file

@ -14290,6 +14290,10 @@ tsubst_copy_and_build (tree t,
return r;
}
case TRANSACTION_EXPR:
return tsubst_expr(t, args, complain, in_decl,
integral_constant_expression_p);
default:
/* Handle Objective-C++ constructs, if appropriate. */
{

View file

@ -1,3 +1,7 @@
2011-11-21 Torvald Riegel <triegel@redhat.com>
* g++.dg/tm/template-2.C: New test.
2011-11-21 Jakub Jelinek <jakub@redhat.com>
PR debug/50827

View file

@ -0,0 +1,22 @@
// { dg-do compile }
// { dg-options "-fgnu-tm -O -std=c++0x -fdump-tree-tmmark" }
struct TrueFalse
{
};
int global;
template<typename T> int foo()
{
return __transaction_atomic (global + 2)
+ __transaction_atomic (global + 3);
}
int f1()
{
return foo<TrueFalse>();
}
/* { dg-final { scan-tree-dump-times "ITM_RU" 2 "tmmark" } } */
/* { dg-final { cleanup-tree-dump "tmmark" } } */