Author: faisalv
Date: Wed Feb 24 23:09:30 2016
New Revision: 261823

URL: http://llvm.org/viewvc/llvm-project?rev=261823&view=rev
Log:
Twek fix for PR24473 (r261506) - Preserve the template arguments as written
(within the DeclRefExpr Node) when creating AST nodes that reference 
specializations of static data member templates.  While we pass the template 
args through for all non-instance members, they should only be relevant (i.e. 
non-null) for variable template ids (assertion added for that assumption)

Also preserve the FoundDecl that refers to the canonical Decl (the  primary 
VarTemplateDecl for a variable template specialization) that we are referencing 
in our DeclRefExpr. Not sure why this was not being done for non-variable 
template-ids.  

No functionality change - so no tests added.

Thanks to Richard Smith for drawing my attention to this!

Modified:
    cfe/trunk/lib/Sema/SemaExprMember.cpp

Modified: cfe/trunk/lib/Sema/SemaExprMember.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprMember.cpp?rev=261823&r1=261822&r2=261823&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprMember.cpp Wed Feb 24 23:09:30 2016
@@ -1100,6 +1100,8 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
       // declaration corresponding to the supplied template arguments
       // (while emitting diagnostics as necessary) that will be referenced
       // by this expression.
+      assert((!TemplateArgs || isa<VarTemplateDecl>(MemberDecl)) &&
+             "How did we get template arguments here sans a variable 
template");
       if (isa<VarTemplateDecl>(MemberDecl)) {
         MemberDecl = getVarTemplateSpecialization(
             *this, cast<VarTemplateDecl>(MemberDecl), TemplateArgs,
@@ -1107,7 +1109,8 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
         if (!MemberDecl)
           return ExprError();
       }
-      return BuildDeclarationNameExpr(SS, R.getLookupNameInfo(), MemberDecl);
+      return BuildDeclarationNameExpr(SS, R.getLookupNameInfo(), MemberDecl,
+                                      FoundDecl, TemplateArgs);
     }
     SourceLocation Loc = R.getNameLoc();
     if (SS.getRange().isValid())


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to