The below example compiles fine in both gcc and msvc:
template <typename>
struct Foo {
template <typename T>
struct Bar {
Bar(T val):
val_(val)
{
}
T val_;
};
};
auto func() {
return Foo<int>::Bar(3);
}
In clang there seems to be a need for an extra deduction guide, for it to compile:
template <typename>
struct Foo {
template <typename T>
struct Bar {
Bar(T val):
val_(val)
{
}
T val_;
};
template <typename T>
Bar(T) -> Bar<T>; // deduction guide
};
auto func() {
return Foo<int>::Bar(3);
}
Is there a rationale behind this extra requirement in clang? Or is it just a difference in the interpretation of something that's unclear in the standard to begin with?