<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 --- - Non-type parameter link failure in a template function with a dependent template parameter"
href="https://llvm.org/bugs/show_bug.cgi?id=27851">27851</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Non-type parameter link failure in a template function with a dependent template parameter
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>URL</th>
<td>http://coliru.stacked-crooked.com/a/76dbf47d66e9ba0e
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kirshamir@yahoo.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The following code:
---
#include <iostream>
using namespace std;
template <class T, T v> struct foo{
static constexpr T val = v;
};
template <class T, T v1, T v2> void isSame4(foo<T, v1> f1, foo<T, v2> f2) {
cout << "val1: " << f1.val << ", val2: " << f2.val << " are NOT the same"
<< endl;
}
template <class T, T v> void isSame4(foo<T, v> f1, foo<T, v> f2) {
cout << "val1: " << f1.val << ", val2: " << f2.val << " are the same" <<
endl;
}
int global1 = 3;
int main() {
isSame4(foo<int, 1>(), foo<int, 1>()); // ok
isSame4(foo<int*, &global1>(), foo<int*, &global1>()); // error
}
---
Linker error:
undefined reference to `foo<int*, &global1>::val'
(Same, compiles well on g++ 6.1.0).
Related (?):
#15858: <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Non-type parameter link failure"
href="show_bug.cgi?id=15858">https://llvm.org/bugs/show_bug.cgi?id=15858</a></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>