Skip to content

Commit 3d273eb

Browse files
committed
Add asserts
1 parent 3911696 commit 3d273eb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ matchEnableIfSpecializationImplTypename(TypeLoc TheType) {
7979
if (!TD || TD->getName() != "enable_if")
8080
return std::nullopt;
8181

82+
assert(!TD->getTemplateParameters()->empty() &&
83+
"found template with no template parameters?");
8284
const auto *FirstParam = dyn_cast<NonTypeTemplateParmDecl>(
8385
TD->getTemplateParameters()->getParam(0));
8486
if (!FirstParam || !FirstParam->getType()->isBooleanType())
@@ -114,6 +116,8 @@ matchEnableIfSpecializationImplTrait(TypeLoc TheType) {
114116
if (!Specialization->isTypeAlias())
115117
return std::nullopt;
116118

119+
assert(!TD->getTemplateParameters()->empty() &&
120+
"found template with no template parameters?");
117121
const auto *FirstParam = dyn_cast<NonTypeTemplateParmDecl>(
118122
TD->getTemplateParameters()->getParam(0));
119123
if (!FirstParam || !FirstParam->getType()->isBooleanType())

0 commit comments

Comments
 (0)