Index: include/clang/Basic/DiagnosticParseKinds.td
===================================================================
--- include/clang/Basic/DiagnosticParseKinds.td	(revision 189305)
+++ include/clang/Basic/DiagnosticParseKinds.td	(working copy)
@@ -305,6 +305,8 @@
 def err_expected_class_name : Error<"expected class name">;
 def err_expected_class_name_not_template : 
   Error<"'typename' is redundant; base classes are implicitly types">;
+def err_expected_template_arguments :
+  Error<"expected template argument list after template-id">;
 def err_unspecified_vla_size_with_static : Error<
   "'static' may not be used with an unspecified variable length array size">;
 def warn_deprecated_register : Warning<
Index: lib/Parse/ParseDeclCXX.cpp
===================================================================
--- lib/Parse/ParseDeclCXX.cpp	(revision 189305)
+++ lib/Parse/ParseDeclCXX.cpp	(working copy)
@@ -960,7 +960,13 @@
                                         /*NonTrivialTypeSourceInfo=*/true,
                                         &CorrectedII);
   if (!Type) {
-    Diag(IdLoc, diag::err_expected_class_name);
+    Sema::NameClassification Classification =
+        Actions.ClassifyName(getCurScope(), SS, Id, IdLoc, NextToken(), false);
+    if (Classification.getKind() == Sema::NC_TypeTemplate) {
+      Diag(IdLoc, diag::err_expected_template_arguments);
+    } else {
+      Diag(IdLoc, diag::err_expected_class_name);
+    }
     return true;
   }
 
Index: test/Parser/cxx-class.cpp
===================================================================
--- test/Parser/cxx-class.cpp	(revision 189305)
+++ test/Parser/cxx-class.cpp	(working copy)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -verify -pedantic %s
 class C;
 class C {
 public:
@@ -113,6 +113,15 @@
   }
 }
 
+namespace PR8382 {
+  template <class T> class Foo {};
+  class Bar : public Foo {};  // expected-error {{expected template argument list after template-id}}
+
+  template <typename T> void Aaa();
+  template <typename T> class Aab {};
+  class Bbb : public Aaa {};  // expected-error {{expected class name}}
+}
+
 // PR11109 must appear at the end of the source file
 class pr11109r3 { // expected-note{{to match this '{'}}
   public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}}
