I basically have a class that depends on a non-type template parameter. I defined a casting so an object of non-type template parameter N
can convert to another of
This is a clang bug. Here's a short reproduction:
template
struct X {
template
X foo();
};
template
template
X X::foo() {
return {};
}
If auto B
is replaced by int B
, clang accepts it. gcc accepts it as-is. For clang, this is only a problem with the nested template
declarations. There's nothing about auto
as a placeholder template non-type parameter that would prevent it from being used to define something out-of-line.
While filing a new clang bug, I found 35655, with an even shorter reproduction:
template
struct S {
template
static void f() {
+n;
}
};
which fails with:
source.cpp:5:3: error: invalid argument type 'auto' to unary expression
+n;