Index: test/SemaCXX/2011-09-15-MemberFieldTemplate.cpp
===================================================================
--- test/SemaCXX/2011-09-15-MemberFieldTemplate.cpp	(revision 0)
+++ test/SemaCXX/2011-09-15-MemberFieldTemplate.cpp	(revision 0)
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename TN>
+class Foo {
+
+public:
+    void foo() {}
+private:
+	
+    template<typename T>
+    T SomeField; // expected-error {{member 'SomeField' declared as a template}}
+};
+
+int main (int argc, char const *argv[]) {
+
+    Foo<int> f;
+    f.foo();
+
+    return 0;
+}
Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td	(revision 139826)
+++ include/clang/Basic/DiagnosticSemaKinds.td	(working copy)
@@ -1944,6 +1944,10 @@
 def err_template_variable : Error<"variable %0 declared as a template">;
 def err_template_variable_noparams : Error<
   "extraneous 'template<>' in declaration of variable %0">;
+def err_template_member : Error<"member %0 declared as a template">;
+def err_template_member_noparams : Error<
+  "extraneous 'template<>' in declaration of member %0">;
+  
 def err_template_tag_noparams : Error<
   "extraneous 'template<>' in declaration of %0 %1">;
 def err_template_decl_ref : Error<
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp	(revision 139826)
+++ lib/Sema/SemaDeclCXX.cpp	(working copy)
@@ -1121,6 +1121,43 @@
   if (isInstField) {
     CXXScopeSpec &SS = D.getCXXScopeSpec();
     
+    // FIXME: Check that the name is an identifier!
+    IdentifierInfo *II = Name.getAsIdentifierInfo();
+
+    // Match up the template parameter lists with the scope specifier, then
+    // determine whether we have a template or a template specialization.
+    bool isExplicitSpecialization = false;
+    bool Invalid = false;
+    if (TemplateParameterList *TemplateParams =
+          MatchTemplateParametersToScopeSpecifier(
+                                D.getDeclSpec().getSourceRange().getBegin(),
+                                D.getIdentifierLoc(),
+                                D.getCXXScopeSpec(),
+                                TemplateParameterLists.get(),
+                                TemplateParameterLists.size(),
+                                /*never a friend*/false,
+                                isExplicitSpecialization,
+                                Invalid)) {
+
+      if (TemplateParams->size() > 0) {
+        // There is no such thing as a variable template.
+        Diag(D.getIdentifierLoc(), diag::err_template_member)
+            << II
+            << SourceRange(TemplateParams->getTemplateLoc(),
+                TemplateParams->getRAngleLoc());
+        return 0;
+      }
+      else {
+        // There is an extraneous 'template<>' for this variable. Complain
+        // about it, but allow the declaration of the variable.
+        Diag(TemplateParams->getTemplateLoc(),
+            diag::err_template_member_noparams)
+            << II
+            << SourceRange(TemplateParams->getTemplateLoc(),
+                TemplateParams->getRAngleLoc());
+      }
+    }
+
     if (SS.isSet() && !SS.isInvalid()) {
       // The user provided a superfluous scope specifier inside a class
       // definition:
@@ -1138,9 +1175,7 @@
        
       SS.clear();
     }
-    
-    // FIXME: Check for template parameters!
-    // FIXME: Check that the name is an identifier!
+
     Member = HandleField(S, cast<CXXRecordDecl>(CurContext), Loc, D, BitWidth,
                          HasDeferredInit, AS);
     assert(Member && "HandleField never returns null");
