<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Problem with using "enum""
href="https://llvm.org/bugs/show_bug.cgi?id=30254">30254</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Problem with using "enum"
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>TableGen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>valery.pykhtin@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The following testcase:
<<<<<<<
class Operand {}
def Enum : Operand {
int AAA = 1;
int BBB = 2;
}
class getString<int Selector> {
string ret =
!if(!eq(Selector, Enum.AAA), "AAA",
!if(!eq(Selector, Enum.BBB), "BBB",
""));
}
class S <int Selector, int SelectorCopy = Selector> {
string v1 = getString<Selector>.ret; // <-- Doesnt resolve!
string v2 = getString<SelectorCopy>.ret; // <-- but this resolve!
}
// Works ok
def C1 : S <1>;
def C2 : S <2>;
// Incorrect version, S:v1 doesnt resolve to a string
def W1 : S <Enum.AAA>;
def W2 : S <Enum.BBB>;
<span class="quote">>>>>>>></span >
gives the following output:
------------- Classes -----------------
class Operand {
string NAME = ?;
}
class S<int S:Selector = ?, int S:SelectorCopy = S:Selector> {
string v1 = anonymous_0.ret;
string v2 = anonymous_1.ret;
string NAME = ?;
}
class getString<int getString:Selector = ?> {
string ret = !if(!eq(getString:Selector, Enum.AAA), "AAA",
!if(!eq(getString:Selector, Enum.BBB), "BBB", ""));
string NAME = ?;
}
------------- Defs -----------------
def C1 { // S
int S:SelectorCopy = 1;
string v1 = "AAA";
string v2 = "AAA";
string NAME = ?;
}
def C2 { // S
int S:SelectorCopy = 2;
string v1 = "BBB";
string v2 = "BBB";
string NAME = ?;
}
def Enum { // Operand
int AAA = 1;
int BBB = 2;
string NAME = ?;
}
def W1 { // S
int S:SelectorCopy = 1;
string v1 = anonymous_0.ret;
string v2 = "AAA";
string NAME = ?;
}
def W2 { // S
int S:SelectorCopy = 2;
string v1 = anonymous_0.ret;
string v2 = "BBB";
string NAME = ?;
}
def anonymous_0 { // getString
string ret = !if(!eq(S:Selector, 1), "AAA", !if(!eq(S:Selector, 2), "BBB",
""));
string NAME = ?;
}
def anonymous_1 { // getString
string ret = !if(!eq(S:SelectorCopy, 1), "AAA", !if(!eq(S:SelectorCopy, 2),
"BBB", ""));
string NAME = ?;
}
Here W1.v1 and W2.v1 doesn't resolve correctly to a string value.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>