Open
Description
Reference (section label): [temp.deduct.call]
Issue description
Consider the following example:
struct T {
template<int N>
T(const char(&)[N]) {}
};
struct S {
S(const char(&)[5]) {}
};
T t({"awoo"}); // error: initializer-string for char array is too long
S s({"awoo"}); // OK
There is a surprising and likely unintentional inconsistency here. Implementations diverge on whether the initialization of t
is valid.
While [dcl.init.string] generally allows initialization of character arrays with a string-literal that is surrounded by braces, [temp.deduct.call] paragraph 1 states that N
is deduced to the length of the initializer list, which is 1
, resulting in a failed attempt at initializing const char(&)[1]
with "awoo"
.
Suggested resolution
W.I.P.
Metadata
Metadata
Assignees
Labels
No labels