Index: testsuite/g++.dg/tm/pr51212.C
===================================================================
--- testsuite/g++.dg/tm/pr51212.C	(revision 0)
+++ testsuite/g++.dg/tm/pr51212.C	(revision 0)
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm -fnon-call-exceptions" }
+
+struct S
+{
+  S ()
+  {
+  }
+};
+
+__attribute__ ((transaction_callable))
+void foo (int *p)
+{
+  S s;
+  if (*p)
+    ;
+}
+
+// { dg-message "sorry, unimplemented: non call exceptions and transactional memory" "-fnon-call-exceptions and -fgnu-tm together" { target *-*-* } 0 }
Index: opts.c
===================================================================
--- opts.c	(revision 182542)
+++ opts.c	(working copy)
@@ -663,6 +663,9 @@ finish_options (struct gcc_options *opts
       opts->x_flag_toplevel_reorder = 0;
     }
 
+  if (opts->x_flag_tm && opts->x_flag_non_call_exceptions)
+    sorry ("non call exceptions and transactional memory are not supported");
+
   /* -Wmissing-noreturn is alias for -Wsuggest-attribute=noreturn.  */
   if (opts->x_warn_missing_noreturn)
     opts->x_warn_suggest_attribute_noreturn = true;
