Review Request: Simple support for "=default" and "=delete"
David Nolden
david.nolden.kde at art-master.de
Sat Feb 26 12:05:36 UTC 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/100720/#review1661
-----------------------------------------------------------
The parser can be extended for C++ 0x, it's not a matter of "rewriting".
This workaround problematic, because the consequences of allowing "default" and "delete" as primary expressions might be very far-reaching.
- David
On Feb. 23, 2011, 1:46 a.m., Branan Purvine-Riley wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/100720/
> -----------------------------------------------------------
>
> (Updated Feb. 23, 2011, 1:46 a.m.)
>
>
> Review request for KDevelop.
>
>
> Summary
> -------
>
> This is a very cursory patch to accept the "=default" and "=delete" C++0x constructs.
>
> The main design issue is that class member declarations are parsed with the exact same code as regular declarations, and thus the '=' is seen as an initializer. This 'works' for the pure-virtual "=0", but also allows "=5" or "=pi" as perfectly valid constructs. This patch simply adds "default" and "delete" to the list of primary expressions so they will be accepted in that initializer, and thus 'work' in the same way that the pure-virtual specifier does.
>
> This is the wrong way to do it, both for the C++0x constructs and the pure-virtual "=0". The patch simply clears up some red squigglies without a major parser overhaul. Long-term, that parser rewrite will probably need to be done anyway - there are plenty of other C++0x grammar differences that need to be fixed.
>
> Short-term, it may be worth pushing this into master so that some of the simpler C++0x forms are accepted in 4.3, if the parser rewrite hasn't been done by then.
>
>
> Diffs
> -----
>
> languages/cpp/parser/parser.cpp 281ad8dd5b5878b049b0a0f2e29a48ae42d33a5f
>
> Diff: http://git.reviewboard.kde.org/r/100720/diff
>
>
> Testing
> -------
>
> Because of the way this is implemented, "delete" and "default" are now accepted anywhere a primary-expression is expected. (for example, "int a=delete;")
>
>
> Thanks,
>
> Branan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20110226/81d0d8ce/attachment.html>
More information about the KDevelop-devel
mailing list