hintonda updated this revision to Diff 102292. hintonda added a comment. Rebase, fix test, and add FIXME note.
https://reviews.llvm.org/D16971 Files: lib/Sema/SemaTemplate.cpp test/SemaTemplate/partial-spec-fully-specified.cpp Index: test/SemaTemplate/partial-spec-fully-specified.cpp =================================================================== --- /dev/null +++ test/SemaTemplate/partial-spec-fully-specified.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +template <class T> +struct Base{}; + +template <class A, class B> +class Test {}; + +template <class T> +class Test<void, void> : Base<T> { // expected-error{{partial specialization of 'Test' does not use any of its template parameters}} + Test() {} +}; Index: lib/Sema/SemaTemplate.cpp =================================================================== --- lib/Sema/SemaTemplate.cpp +++ lib/Sema/SemaTemplate.cpp @@ -3418,7 +3418,9 @@ InstantiationDependent)) { Diag(TemplateNameLoc, diag::err_partial_spec_fully_specialized) << VarTemplate->getDeclName(); - IsPartialSpecialization = false; + // FIXME: Can this ever get triggered? If so, we need test. If not, + // should this if be removed? + return true; } if (isSameAsPrimaryTemplate(VarTemplate->getTemplateParameters(), @@ -7276,7 +7278,7 @@ TemplateArgs.arguments(), InstantiationDependent)) { Diag(TemplateNameLoc, diag::err_partial_spec_fully_specialized) << ClassTemplate->getDeclName(); - isPartialSpecialization = false; + return true; } }
Index: test/SemaTemplate/partial-spec-fully-specified.cpp =================================================================== --- /dev/null +++ test/SemaTemplate/partial-spec-fully-specified.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +template <class T> +struct Base{}; + +template <class A, class B> +class Test {}; + +template <class T> +class Test<void, void> : Base<T> { // expected-error{{partial specialization of 'Test' does not use any of its template parameters}} + Test() {} +}; Index: lib/Sema/SemaTemplate.cpp =================================================================== --- lib/Sema/SemaTemplate.cpp +++ lib/Sema/SemaTemplate.cpp @@ -3418,7 +3418,9 @@ InstantiationDependent)) { Diag(TemplateNameLoc, diag::err_partial_spec_fully_specialized) << VarTemplate->getDeclName(); - IsPartialSpecialization = false; + // FIXME: Can this ever get triggered? If so, we need test. If not, + // should this if be removed? + return true; } if (isSameAsPrimaryTemplate(VarTemplate->getTemplateParameters(), @@ -7276,7 +7278,7 @@ TemplateArgs.arguments(), InstantiationDependent)) { Diag(TemplateNameLoc, diag::err_partial_spec_fully_specialized) << ClassTemplate->getDeclName(); - isPartialSpecialization = false; + return true; } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits