Don't set out-of-line template specialization/definition information
for AST nodes that aren't actually out-of-line (i.e., require a
nested-name-specifier). Fixes <rdar://problem/8204126>.

llvm-svn: 109704
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1788eb7..1836c47 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2617,7 +2617,7 @@
 
   SetNestedNameSpecifier(NewVD, D);
 
-  if (NumMatchedTemplateParamLists > 0) {
+  if (NumMatchedTemplateParamLists > 0 && D.getCXXScopeSpec().isSet()) {
     NewVD->setTemplateParameterListsInfo(Context,
                                          NumMatchedTemplateParamLists,
                         (TemplateParameterList**)TemplateParamLists.release());
@@ -3216,7 +3216,7 @@
     }
   }
 
-  if (NumMatchedTemplateParamLists > 0) {
+  if (NumMatchedTemplateParamLists > 0 && D.getCXXScopeSpec().isSet()) {
     NewFD->setTemplateParameterListsInfo(Context,
                                          NumMatchedTemplateParamLists,
                         (TemplateParameterList**)TemplateParamLists.release());