On Thu, Feb 9, 2012 at 5:04 PM, Chandler Carruth <[email protected]> wrote: > On Thu, Feb 9, 2012 at 12:42 PM, Matt Beaumont-Gay <[email protected]> > wrote: >> >> On a different note, what do you think about not warning when the >> return type is incomplete? It's a little surprising that we warn on >> this: >> >> struct foo; >> extern "C" { struct foo get_foo(void); } >> struct foo { }; > > > I think that's a bug. Incomplete struct types are relatively common as > "opaque" return types.
Oddly enough, MSVC does complain on that code. error C2526: 'get_foo' : C linkage function cannot return C++ class 'foo' It's hard to really say one way or the other, since you can make a case either way. Yes, it may be perfectly fine as an opaque type, but it may also contain non-C-compatible fields which would justify the warning. ~Aaron _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
