<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello all,<br>
<br>
I'm seeing an assert when compiling code like this:<br>
<br>
<blockquote>template <int i> struct X { };<br>
void f(X<8> x) {<br>
X<7> y;<br>
y = x;<br>
}<br>
</blockquote>
<br>
DiffTemplate/GetExpr (in ASTDiagnostic.cpp) assumes that the
non-type args are expressions:<br>
<blockquote>void DiffTemplate() {<br>
<br>
// Handle Expressions<br>
if (NonTypeTemplateParmDecl *DefaultNTTPD =<br>
dyn_cast<NonTypeTemplateParmDecl>(ParamND)) {<br>
Expr *FromExpr, *ToExpr;<br>
GetExpr(FromIter, DefaultNTTPD, FromExpr);<br>
GetExpr(ToIter, DefaultNTTPD, ToExpr);<br>
}<br>
<br>
}<br>
</blockquote>
<blockquote>void GetExpr(const TSTiterator &Iter, ) {<br>
<br>
if (!Iter.isEnd())<br>
ArgExpr = Iter->getAsExpr();<br>
<br>
}<br>
</blockquote>
<br>
But in some cases they are integral values (e.g. Iter->getKind()
== TemplateArgument::Integral). As a result, an assertion inside
Iter->getAsExpr() fails.<br>
<br>
Is DiffTemplate broken or should the integral arg never have found
it's way to it?<br>
<br>
BTW, I modified GetExpr to create an Expr from the Integral arg and
that seemed to work, but I'm not sure if that's the right thing to
do.<br>
<br>
Cheers,<br>
Matthew C.<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</pre>
</body>
</html>