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] Fix PR c++/28347


Lee Millward wrote:
> There's a comment in start_decl which reads:
> 
> Is it valid for this decl to have an initializer at all?
> If not, set INITIALIZED to zero, which will indirectly
> tell `cp_finish_decl' to ignore the initializer once it is parsed.

Yes, that comment does seem to be obsolete.

> libstdc++ so I abandoned that approach. The fix in the patch I've
> attached is to discard the decl once a diagnostic is issued about an
> invalid initialiser and to return error_mark_node at that point rather
> than continue.

I agree, that makes sense.  In particular, if the user wrote:

  typedef int i = 0;

it's not at all clear that they meant to type "typedef int i;" -- they
might equally well have meant "static int i = 0;", for example.  So, for
error-recovery purposes, just discarding the typedef is probably reasonable.

The patch is OK.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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