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] Reject invalid specifiers for virtual functions


> 
> The following patch addresses the problem that we currently accept
> invalid pure specifiers for virtual functions like the following
> 
>    virtual void foo () = 0l;
> 
> since we only check integer_zerop in cp_parser_pure_specifier.
> To make sure that the pure specifier is really just '0' we
> need some support from the lexer.
> 
> The following patch adds NAMED_OP to the cpp_flags in c_lex_with_flags
> when a single '0' is encountered.
> In cp_parser_pure_specifier we then check for NAMED_OP to identify a
> correct pure specifier.
> 
> I tried to change the lexer as few as possible and stay completely out
> of libcpp. Therefore I chose to reuse an already existing flag from the
> cpp_token structure - and NAMED_OP is the only C++ specific one.
> 
> Btw, as I found out after writing the patch, there's a similar one
> (that never got finished AFAIK) by Michael Matz:
> http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02318.html
> 
> 
> Bootstrapped and regtested on x86_64-unknown-linux-gnu.
> Ok for mainline?

And this is PR 23333.

-- Pinski


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