<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96670>96670</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
template parameter comparison against default value doesn't handle LValue
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielJump
</td>
</tr>
</table>
<pre>
An assertion is thrown here for this code. APValue is an LValue, not an Int.
This is against release/18.x
```
inline constexpr long ullNil = -1;
template<typename T = long, const T &Nil = ullNil>
struct Test {};
inline constexpr long lNil = -1;
Test<long, lNil> c;
```
```
#6 0x00007ff608f49f7c clang::APValue::isInt Z:\repos\llvm\clang\include\clang\AST\APValue.h:401:0
#7 0x00007ff608f49f7c clang::APValue::getInt Z:\repos\llvm\clang\include\clang\AST\APValue.h:424:0
#8 0x00007ff608f49f7c clang::Expr::EvaluateKnownConstInt(class clang::ASTContext const &, class llvm::SmallVectorImpl<struct std::pair<class clang::SourceLocation, class clang::PartialDiagnostic>> *) const Z:\repos\llvm\clang\lib\AST\ExprConstant.cpp:15862:0
#9 0x00007ff608e0e3d7 llvm::APSInt::isSameValue Z:\repos\llvm\llvm\include\llvm\ADT\APSInt.h:320:0
#10 0x00007ff608e0e3d7 templateArgumentExpressionsEqual Z:\repos\llvm\clang\lib\AST\TypePrinter.cpp:2135:0
#11 0x00007ff608e021d8 isSubstitutedTemplateArgument Z:\repos\llvm\clang\lib\AST\TypePrinter.cpp:2160:0
#12 0x00007ff608e01fec clang::isSubstitutedDefaultArgument(class clang::ASTContext &, class clang::TemplateArgument, class clang::NamedDecl const *, class llvm::ArrayRef<class clang::TemplateArgument>, unsigned int) Z:\repos\llvm\clang\lib\AST\TypePrinter.cpp:2199:0
#13 0x00007ff60824dbb3 clang::TemplateArgument::setIsDefaulted Z:\repos\llvm\clang\include\clang\AST\TemplateBase.h:389:0
```
</pre>
<img width="1px" height="1px" alt="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