This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, C] Fix PR40563


2010/7/28 Shujing Zhao <pearly.zhao@oracle.com>:
> On 07/27/2010 09:58 PM, Joseph S. Myers wrote:
>>
>> On Wed, 21 Jul 2010, Shujing Zhao wrote:
>>
>>> Index: c-decl.c
>>> ===================================================================
>>> --- c-decl.c ? ?(revision 162361)
>>> +++ c-decl.c ? ?(working copy)
>>> @@ -4103,6 +4103,35 @@ start_decl (struct c_declarator *declara
>>> ? return tem;
>>> ?}
>>> ?+/* Subroutine of finish_decl. Diagnose uninitialized const member of
>>> type TYPE.
>>> + ? DECL is the original declaration. */
>>
>> This comment is unclear. ?What you seem to mean is: TYPE is the type of an
>> uninitialized object DECL. ?If that object has a const member, diagnose
>> this.
>>
> Thanks.
>>
>> Why do you need to recurse down among fields? ?Why isn't checking
>> C_TYPE_FIELDS_READONLY enough?
>>
> It used to notice which field should be initialized, just like the
> diagnostics at c++. If the notice is not very necessary,
> C_TYPE_FIELDS_READONLY is enough.
>
>> What if the original uninitialized object is not a structure but an array
>> of structures? ?Will you diagnose things in that case?
>
> C++ would not error an uninitialized array of structure that has a const
> member. ?So I think it doesn't need warn at C?

It seems to be PR c++/43719, which should be fixed on mainline.

-- 
Fabien


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]