Review Request: Simple support for "=default" and "=delete"
Branan Purvine-Riley
branan at gmail.com
Wed Feb 23 01:46:50 UTC 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/100720/
-----------------------------------------------------------
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/20110223/c4a5a7c4/attachment.html>
More information about the KDevelop-devel
mailing list