https://llvm.org/bugs/show_bug.cgi?id=29158
Bug ID: 29158
Summary: Nested template class partial specialization cannot be
used
Product: clang
Version: 3.7
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
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:
http://stackoverflow.com/questions/39180110/clang-fatal-error-recursive-template-instantiation-exceeded-maximum-depth
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs