<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/160672>160672</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Can't use parameter pack llvm::isa inside assert
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:support
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lukel97
</td>
</tr>
</table>
<pre>
I noticed this in #160274, where I had an assert like
```c++
assert(isa<InsertElementInst>(VecI) ||
isa<InsertValueInst>(VecI) &&
"Packed operands must generate an insertelement or insertvalue");
```
But there's a handy version of llvm::isa that uses parameter packs so you can pass multiple types to check against, however this seems to fail when used inside of the assert:
```c++
assert(isa<InsertElementInst, InsertValueInst>(VecI) &&
"Packed operands must generate an insertelement or insertvalue");
```
```
llvm-project/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:3271:35: error: too many arguments provided to function-like macro invocation
3271 | assert(isa<InsertElementInst, InsertValueInst>(VecI) &&
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/assert.h:71:9: note: macro 'assert' defined here
71 | #define assert(e) \
| ^
llvm-project/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:3271:5: error: use of undeclared identifier 'assert'
3271 | assert(isa<InsertElementInst, InsertValueInst>(VecI) &&
| ^
2 errors generated.
```
The parameter pack overload works fine outside of the assert. I'm not sure if this specific to the MacOSX toolchain or not. Running into this on clang version 21.1.2, arm64-apple-darwin24.6.0
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VU2P2zgM_TXKhRjDphN7fPAhkzZAsFhs0RZFr4zMxNrIkiHJGcz--gXttPPRHhbYNmAgW6YkvvdIimI0Z8fcqs2D2rxb0ZR6H1o7Xdg29erou6f2AM4no7mD1JsIxoHCsqhyrNcKd_DYc2A4QE8dkAOKkUMCay6s8q1YlS-mFT6I5dubk8J7E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