Thank you for clarifying. - Fariborz On Sep 18, 2014, at 9:41 AM, David Majnemer <[email protected]> wrote:
> Yes, this change was done intentionally to be compatible with their behavior: > > Microsoft (R) C/C++ Optimizing Compiler Version 19.00.22013.1 for x64 > Copyright (C) Microsoft Corporation. All rights reserved. > > anon.c > anon.c(2): error C2027: use of undefined type 'undefined' > anon.c(2): note: see declaration of 'undefined' > > > > On Thu, Sep 18, 2014 at 9:38 AM, jahanian <[email protected]> wrote: > > On Sep 18, 2014, at 9:33 AM, jahanian <[email protected]> wrote: > >> >> On Sep 17, 2014, at 5:42 PM, David Majnemer <[email protected]> wrote: >> >>> Author: majnemer >>> Date: Wed Sep 17 19:42:05 2014 >>> New Revision: 218006 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=218006&view=rev >>> Log: >>> Sema: Diagnose undefined structs used as Microsoft anonymous structs >>> >>> Previously, we would not mark structs containing anonymous structs as >>> invalid. Later, horrific things would occur when trying to determine >>> the size of the parent record. >>> >>> Instead, require the struct to be a complete type when used as an >>> anonymous struct. Mark both the anonymous field for the struct and the >>> parent context as invalid (this is similar to what we do when a struct >>> contains a field with an incomplete type.) >> >> >> Thank you David for working on this. Will this test case continue to work >> without error. This was the behavior before: >> >> struct anon_fault { >> struct undefined; >> }; >> >> struct undefined { >> int ii; >> }; >> >> int main() >> { >> return sizeof(struct anon_fault); >> } >> > > We get the error with your patch: > > t.c:2:2: error: field has incomplete type 'struct undefined' > t.c:2:9: note: forward declaration of 'struct undefined' > struct undefined; > ^ > I am not familiar with details of microsoft’s anonymous structs. Is this the > expected behavior? > > - Thanks, Fariborz > > > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
