OSDN Git Service

Fix instantiation of transaction expressions.
authortorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Nov 2011 22:29:13 +0000 (22:29 +0000)
committertorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Nov 2011 22:29:13 +0000 (22:29 +0000)
gcc/cp/
* pt.c (tsubst_copy_and_build): Handle TRANSACTION_EXPR.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181601 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 7b995f1..0d729a9 100644 (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
 2011-11-21  Ed Smith-Rowland  <3dw4rd@verizon.net>
 
        PR c++/50958
index 2ba26b2..f817b6f 100644 (file)
@@ -14290,6 +14290,10 @@ tsubst_copy_and_build (tree t,
        return r;
       }
 
        return r;
       }
 
+    case TRANSACTION_EXPR:
+      return tsubst_expr(t, args, complain, in_decl,
+            integral_constant_expression_p);
+
     default:
       /* Handle Objective-C++ constructs, if appropriate.  */
       {
     default:
       /* Handle Objective-C++ constructs, if appropriate.  */
       {
index 764575a..c661df8 100644 (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
 2011-11-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/50827
diff --git a/gcc/testsuite/g++.dg/tm/template-2.C b/gcc/testsuite/g++.dg/tm/template-2.C
new file mode 100644 (file)
index 0000000..5387024
--- /dev/null
@@ -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" } } */