[cfe-dev] Initialization of an anonymous struct within a class
Douglas Gregor
dgregor at apple.com
Mon Aug 9 15:48:30 PDT 2010
On Aug 9, 2010, at 12:58 PM, Shaun Jackman wrote:
> Hi,
>
> I'm not sure whether an anonymous struct within a class is standard, or
> a GCC extension that clang attempts to support. In any case, the
> following code snippet gives this error:
>
> anonymous-struct.cc:9:16: error: multiple initializations given for non-static member 'y'
> Foo() : x(0), y(0) { }
> ^~~~
> anonymous-struct.cc:9:10: note: previous initialization is here
> Foo() : x(0), y(0) { }
> ^
> 2 diagnostics generated.
>
> Just for comparison, I've also given code that does not use an anonymous
> struct and does compile cleanly.
It's definitely a Clang bug, and while I know I've seen this issue at least once before, it doesn't seem to be in our bug tracker. Could you file a bug on LLVM's Bugzilla?
- Doug
More information about the cfe-dev
mailing list