在 2019/2/28 下午8:23, Ruslan Garipov 写道:
> Hello, Hao!  Thanks a lot for review!
> 
>> This could be fixed by defining the struct inside `SSVARIANT`
>> directly
> 
> Yes, if I implement the `SSVARIANT` like this:
> 
> (... abridged ...)
> 
> g++ compiles the file just fine.  But now we get errors with cc
> compiler:
> 
> (... abridged ...)
> 
> It looks like the compiler sees the both `Foo` and `Boo` type
> declarations as declarations of *anonymous structures*, whose members
> must be considered as members of the containing structure ([6.7.2.1] 13
> Structure and union specifiers).
> 
> x86_64-pc-linux-gnu-cc compiles the same code just well, without error.
> 
> Therefore, I want to propose to use `#ifdef __cplusplus` on the updated
> `SSVARIANT` structure shown in this post to declare "new" dedicated
> nested structures (`_{Time2,DateTime{,Offset},NChar,...}Val`) as
> **nested** ones only for C++, and to declare the same structures for C
> just before the declaration of the `SSVARIANT` structure† (or to use
> "original" version of the `SSVARIANT` structure).
> 
> † If one moves declaration of the `Foo` and `Boo` out of the declaration
> of the `A` structure, x86_64-w64-mingw32-cc compiles the sample.c
> without any errors.
> 
> What do you think about this?
> 


See a66e407efbadeeca6a0bdb4fd7b39a6f8275958f . It looks like a similar
issue, so I presume a similar solution would apply. If it fails with CC
then probably CC is out of interest.

Hmm I am not familiar with CC. Perhaps it is just a symlink to GCC and
GCC behaves like sort of ancient compiler if it finds itself being
called 'CC'... ?

-- 
Best regards,
LH_Mouse

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to