From: Douglas Gregor Date: Thu, 14 Jan 2010 18:13:22 +0000 (+0000) Subject: After dyn_cast'ing, it generally makes sense to check the *output* of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c781f9cd854f3d5d1c826f4a13382c6abca4cff7;p=clang After dyn_cast'ing, it generally makes sense to check the *output* of the dyn_cast against NULL rather than the *input*. Fixes PR6025. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93435 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 471d0c2a2a..7b433e901e 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -2174,7 +2174,7 @@ MarkUsedTemplateParameters(Sema &SemaRef, // FIXME: if !OnlyDeduced, we have to walk the whole subexpression to // find other occurrences of template parameters. const DeclRefExpr *DRE = dyn_cast(E); - if (!E) + if (!DRE) return; const NonTypeTemplateParmDecl *NTTP diff --git a/test/SemaTemplate/temp_class_spec.cpp b/test/SemaTemplate/temp_class_spec.cpp index 48026f9131..e86f07a02f 100644 --- a/test/SemaTemplate/temp_class_spec.cpp +++ b/test/SemaTemplate/temp_class_spec.cpp @@ -330,3 +330,21 @@ template class A0; template class A0 { }; // expected-note{{here}} template class A0; template class A0 { }; // expected-error{{redef}} + +namespace PR6025 { + template< int N > struct A; + + namespace N + { + template< typename F > + struct B; + } + + template< typename Protect, typename Second > + struct C; + + template + struct C< T, A< N::B::value > > + { + }; +}