<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 --- - template enum parameter incorrectly mangled during expression evaluation" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24198&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=DDUMf06MYELAe1Nlv7KChiwJLLHbYha4jtK_AOiWqwQ&m=3xwLY-SgF7lDGugT9uH4odp28faKedX4-598d3QhoVY&s=W-8KJZtzOuMwZJGpehbMZuYix9gPYWP4CLZekLr7nX8&e=">24198</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>template enum parameter incorrectly mangled during expression evaluation
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Reporter</th>
<td>erik.olofsson@hansoft.se
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The following code:
enum ETest
{
ETest_1 = 1
};
template <ETest t_Value>
struct TCTest
{
static ETest ms_Value;
};
template <ETest t_Value>
ETest TCTest<t_Value>::ms_Value = t_Value;
int main()
{
TCTest<ETest_1> ToTest;
&TCTest<ETest_1>::ms_Value;
return 0;
}
Compiled with:
clang++ -O0 -g Test.cpp
Debugged:
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) break set -l 16
Breakpoint 1: where = a.out`main + 13 at Test.cpp:19, address =
0x0000000100000f9d
(lldb) run
Process 60361 launched: '/Source/LLDBBugs/a.out' (x86_64)
Process 60361 stopped
* thread #1: tid = 0x8ec778, 0x0000000100000f9d a.out`main + 13 at Test.cpp:19,
queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100000f9d a.out`main + 13 at Test.cpp:19
16 {
17 TCTest<ETest_1> ToTest;
18 &TCTest<ETest_1>::ms_Value;
-> 19 return 0;
20 }
(lldb) expr ToTest.ms_Value
Internal error [IRForTarget]: Couldn't rewrite external variable
_ZN6TCTestI5ETestE8ms_ValueE
error: 0 errors parsing expression
error: The expression could not be prepared to run in the target
It seems that the enum template parameter is the problem. It should be looking
for
_ZN6TCTestIL5ETest1EE8ms_ValueE
but is looking for:
_ZN6TCTestI5ETestE8ms_ValueE
If you change the template parameter to be an int instead of an enum type it
works.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>