On 12/08/2016 03:42 PM, Martin Sebor wrote:
On 12/08/2016 01:28 PM, Marek Polacek wrote:
On Thu, Dec 08, 2016 at 02:56:56PM -0500, Nathan Sidwell wrote:
struct Foo {
int a;
char ary[];
Foo () : ary ("bob"){}
Clang accepts this test case although it does reject the originally
submitted test case with the messages below. I think GCC should
accept the latter case for compatibility. If it is accepted then
rejecting the original test case will make the array initialization
irregular. I think it would be nice if they both could accepted
but I don't know how much work it would be to make it work.
I think all these should be rejected for the same reason -- they're
equally unmeaningfull. The string being used must be a string literal
-- not a pointer to a caller-provided string, or template argument
(which I could see as plausible use cases). So the problem is being
baked into the class or ctor definition.
nathan
--
Nathan Sidwell