Index: lib/Parse/ParseTemplate.cpp
===================================================================
--- lib/Parse/ParseTemplate.cpp	(revision 169576)
+++ lib/Parse/ParseTemplate.cpp	(working copy)
@@ -236,6 +236,18 @@
     return 0;
   }
 
+  if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) {
+    // C++11 [dcl.attr.grammar] p4:
+    // No attribute-specifier-seq shall appertain to an explicit instantiation
+    SmallVector<SourceRange, 4> Ranges;
+    DeclaratorInfo.getCXX11AttributeRanges(Ranges);
+    if (!Ranges.empty()) {
+      for (SmallVector<SourceRange, 4>::iterator I = Ranges.begin(), 
+           E = Ranges.end(); I != E; ++I)
+        Diag((*I).getBegin(), diag::err_attributes_not_allowed) << *I;
+    }
+  }
+
   LateParsedAttrList LateParsedAttrs(true);
   if (DeclaratorInfo.isFunctionDeclarator())
     MaybeParseGNUAttributes(DeclaratorInfo, &LateParsedAttrs);
Index: test/Parser/cxx0x-attributes.cpp
===================================================================
--- test/Parser/cxx0x-attributes.cpp	(revision 169576)
+++ test/Parser/cxx0x-attributes.cpp	(working copy)
@@ -164,9 +164,18 @@
 };
 template<typename T> void tmpl(T) {}
 template void tmpl [[]] (int); // expected-FIXME {{an attribute list cannot appear here}}
+template void tmpl [[attr]] (float); // expected-error {{an attribute list cannot appear here}}
 template [[]] void tmpl(char); // expected-error {{an attribute list cannot appear here}}
 template void [[]] tmpl(short);
 
+template<typename T> struct S1 {
+  void f() {}
+};
+
+template class S1<int> [[attr]]; // expected-error {{an attribute list cannot appear here}}
+template void S1<void>::f [[attr]] (); // expected-error {{an attribute list cannot appear here}}
+
+
 // Argument tests
 alignas int aligned_no_params; // expected-error {{expected '('}}
 alignas(i) int aligned_nonconst; // expected-error {{'aligned' attribute requires integer constant}} expected-note {{read of non-const variable 'i'}}
