C++11: Automatic indentation does not work properly when using
| Originator: | awwbees | ||
| Number: | rdar://18759521 | Date Originated: | 23-Oct-2014 |
| Status: | Duplicate | Resolved: | Duplicate of 19293424 |
| Product: | Xcode | Product Version: | 6.0.1 (6A317) |
| Classification: | Reproducible: | 100% |
In C++ in Xcode, when overriding a virtual method and inlining the definition of that method, automatic indentation fails to work properly in the rest of the file if that class has multiple inheritance. If I type code like this:
class Test : public Parent1, public Parent2
{
void foo() override { print("foo"); }
Everywhere after that line in the file, the indentation will be screwed up. After pressing enter on that line, instead of being indented one tab in like it should, the cursor will be at the start of the line. If I do indent, then define another method and press enter again, that line will have its indentation removed. It makes it impossible to work within the file and maintain a proper coding standard without constantly re-indenting after every edit.
Curiously, this seems to only be a problem in .h files, and not in .cpp files.
Steps to Reproduce:
1. Install Xcode
2. Create a new project
3. Create a new Header file
4. Type the following:
class Test : public Parent1, public Parent2
{
void foo() override { print("foo"); }
5. Press "enter" after that final line and notice that the cursor does not follow the proper indentation.
6. Attempt to write more code and notice how the indentation behavior insists on removing all indentation.
Expected Results:
Indentation should behave the way it does after writing the same code, with "override" removed:
class Test : public Parent1, public Parent2
{
void foo() { print("foo"); }
Actual Results:
The indentation resets to the beginning of the line for every line after the override keyword.
Version:
Xcode Version 6.0.1 (6A317)
OS X 10.9.5 (13F34)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!