[Bug c++/94619] String literals as non-type template parameter fails to compile with partial specialization of calling function
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Thu Apr 16 16:07:32 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94619
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
The non-void return expression in the void bar function makes the example
ill-formed regardless of the other problem, so let's fix that first:
>>>>>>>>>>>>>>
template <unsigned length> struct A {
char str [length];
constexpr A(char const (&s) [length]) {
for (unsigned i = 0; i < length; ++i)
str[i] = s[i];
}
};
template <A a> struct B {
auto bar() const {
return a.str;
}
};
//template <typename T> void fu (T const& t) // Compiles successfully
template <A a> void fu (B<a> const& t) // Does not compile
//template <unsigned l> void fu (B<A<l>> const& t) // Does not compile either
{
t.bar();
}
void test() {
B<":/"> m;
fu(m);
}
>>>>>>>>>>>>>>>>>>
More information about the Gcc-bugs
mailing list