Bug 426925 - [Refactoring] Renaming function to a memory reference shouldn't be allowed
Summary: [Refactoring] Renaming function to a memory reference shouldn't be allowed
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: Next   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-29 12:04 EST by Gustavo Wagner CLA
Modified: 2020-09-04 15:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo Wagner CLA 2014-01-29 12:04:53 EST
Eclipse IDE for C/C++ Developers
Version: Kepler Service Release 1
Build id: 20130919-0819


Reproducing the bug:


Consider the following code:
======== Original Version ========
int GlobalVar_0 = 0;
int GlobalVar_1 = 100;

int func_0() {
   return GlobalVar_1;
}

int Function_0() {
    return GlobalVar_0;
}
==================================

Now, let's rename the function "func_0" to "&func_0"
Applying the refactoring:
========== Refactored ============
int GlobalVar_0 = 0;
int GlobalVar_1 = 100;

int &func_0() {
   return GlobalVar_1;
}

int Function_0() {
    return GlobalVar_0;
}
=================================

The tool shouldn't allow to apply invalid transformations like this. Notice that now the program has s compilation error. It would be good if it was possible to prevent incorrect renames at least by checking if the function has a valid name.

Thanks in advance.