This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Fix PR c++/28347
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Lee Millward <lee dot millward at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 02 Aug 2006 16:00:39 -0700
- Subject: Re: [patch] Fix PR c++/28347
- References: <email@example.com>
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.
(650) 331-3385 x713