<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 --- - Nested template class partial specialization cannot be used"
href="https://llvm.org/bugs/show_bug.cgi?id=29158">29158</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Nested template class partial specialization cannot be used
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bondvladserg@mail.ru
</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>Define a class with members in following sequence:
1) forward declaration of nested class.
2) usage of this nested class specialization before definition/specialization.
3) definition + specialization
Result: specialization never used in this case
I'm not sure if it is clang bug, but it works on GCC and VS compilers.
Code sample:
#include <iostream>
template<typename T>
struct Foo
{
// Dummy for PARTIAL specialization
// because full specialization is not allowed
template<typename T2, typename Dummy>
struct Bar;
using Type = typename Bar<T, void>::Type;
template<typename T2, typename Dummy>
struct Bar
{
using Type = T2;
};
template<typename Dummy>
struct Bar<double, Dummy>
{
using Type = char;
};
};
int main()
{
static_assert(sizeof(Foo<int>::Type) == sizeof(int),
"sizeof(Foo<int>::Type) != sizeof(int)");
static_assert(sizeof(Foo<double>::Type) == sizeof(char),
"sizeof(Foo<double>::Type) != sizeof(char)");
}
Related question on StackOverflow:
<a href="http://stackoverflow.com/questions/39180110/clang-fatal-error-recursive-template-instantiation-exceeded-maximum-depth">http://stackoverflow.com/questions/39180110/clang-fatal-error-recursive-template-instantiation-exceeded-maximum-depth</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>