Index: lib/AST/TemplateBase.cpp
===================================================================
--- lib/AST/TemplateBase.cpp	(revision 224088)
+++ lib/AST/TemplateBase.cpp	(working copy)
@@ -33,11 +33,22 @@
 /// \param TemplArg the TemplateArgument instance to print.
 ///
 /// \param Out the raw_ostream instance to use for printing.
+///
+/// \param Policy the printing policy for EnumConstantDecl printing.
 static void printIntegral(const TemplateArgument &TemplArg,
-                          raw_ostream &Out) {
+                          raw_ostream &Out, const PrintingPolicy& Policy) {
   const ::clang::Type *T = TemplArg.getIntegralType().getTypePtr();
   const llvm::APSInt &Val = TemplArg.getAsIntegral();
 
+  if (const EnumType* ET = dyn_cast<EnumType>(T)) {
+    for (const EnumConstantDecl* ECD : ET->getDecl()->enumerators()) {
+      if (ECD->getInitVal() == Val) {
+        ECD->printQualifiedName(Out, Policy);
+        return;
+      }
+    }
+  }
+
   if (T->isBooleanType()) {
     Out << (Val.getBoolValue() ? "true" : "false");
   } else if (T->isCharType()) {
@@ -378,7 +389,7 @@
     break;
       
   case Integral: {
-    printIntegral(*this, Out);
+    printIntegral(*this, Out, Policy);
     break;
   }
     
Index: test/SemaCXX/return-noreturn.cpp
===================================================================
--- test/SemaCXX/return-noreturn.cpp	(revision 224088)
+++ test/SemaCXX/return-noreturn.cpp	(working copy)
@@ -143,7 +143,7 @@
 } // expected-warning {{control reaches end of non-void function}}
 
 void PR9412_f() {
-    PR9412_t<PR9412_Exact>(); // expected-note {{in instantiation of function template specialization 'PR9412_t<0>' requested here}}
+    PR9412_t<PR9412_Exact>(); // expected-note {{in instantiation of function template specialization 'PR9412_t<PR9412_MatchType::PR9412_Exact>' requested here}}
 }
 
 struct NoReturn {
Index: test/SemaTemplate/temp_arg_enum_printing.cpp
===================================================================
--- test/SemaTemplate/temp_arg_enum_printing.cpp	(revision 0)
+++ test/SemaTemplate/temp_arg_enum_printing.cpp	(working copy)
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -ast-print %s | FileCheck %s
+
+namespace NamedEnumNS
+{
+  
+enum NamedEnum
+{
+  Val0,
+  Val1
+};
+  
+template <NamedEnum E>
+void foo();
+  
+void test() {
+  // CHECK: template <NamedEnumNS::NamedEnum E = NamedEnumNS::NamedEnum::Val0>
+  NamedEnumNS::foo<Val0>();
+  // CHECK: template <NamedEnumNS::NamedEnum E = NamedEnumNS::NamedEnum::Val1>
+  NamedEnumNS::foo<(NamedEnum)1>();
+  // CHECK: template <NamedEnumNS::NamedEnum E = 2>
+  NamedEnumNS::foo<(NamedEnum)2>();
+}
+  
+} // NamedEnumNS
