Index: testsuite/g++.dg/cpp0x/pr54575.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr54575.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/pr54575.C	(revision 0)
@@ -0,0 +1,27 @@
+// PR c++/54575
+// { dg-do compile { target c++11 } }
+
+template<typename _From, typename _To>
+struct is_convertible { static const bool value = true; };
+
+template<bool> struct enable_if       { };
+template<>     struct enable_if<true> { typedef int type; };
+
+template<typename _InIter>
+using _RequireInputIter
+= typename enable_if<is_convertible<_InIter,bool>::value>::type;
+
+template<typename _Tp>
+struct X
+{
+  template<typename _InputIterator,
+	   typename = _RequireInputIter<_InputIterator>>
+    void insert(_InputIterator) {}
+};
+
+template<typename>
+void foo()
+{
+  X<int> subdomain_indices;
+  subdomain_indices.insert(0);
+}
Index: cp/tree.c
===================================================================
--- cp/tree.c	(revision 191290)
+++ cp/tree.c	(working copy)
@@ -1210,8 +1210,10 @@ strip_typedefs (tree t)
       break;
     }
 
+  if (result == error_mark_node)
+    return error_mark_node;
   if (!result)
-      result = TYPE_MAIN_VARIANT (t);
+    result = TYPE_MAIN_VARIANT (t);
   if (TYPE_USER_ALIGN (t) != TYPE_USER_ALIGN (result)
       || TYPE_ALIGN (t) != TYPE_ALIGN (result))
     {
Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 191290)
+++ cp/pt.c	(working copy)
@@ -6114,6 +6114,8 @@ canonicalize_type_argument (tree arg, tsubst_flags
     return arg;
   mv = TYPE_MAIN_VARIANT (arg);
   arg = strip_typedefs (arg);
+  if (arg == error_mark_node)
+    return error_mark_node;
   if (TYPE_ALIGN (arg) != TYPE_ALIGN (mv)
       || TYPE_ATTRIBUTES (arg) != TYPE_ATTRIBUTES (mv))
     {
