This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 249728 - automatically generated division operator (operator/) multiplies instead of divides.
Summary: automatically generated division operator (operator/) multiplies instead of d...
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-10 03:08 UTC by brian26198
Modified: 2015-01-13 04:17 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
a screen shot of the generated code. (35.05 KB, image/png)
2015-01-10 03:08 UTC, brian26198
Details

Note You need to log in before you can comment on or make changes to this bug.
Description brian26198 2015-01-10 03:08:25 UTC
Created attachment 151437 [details]
a screen shot of the generated code.

Basically the bug is that the automatically generated `C operator/(const C& c) const` method delegates to `C& operator*()` instead of `C& operator/()`. 

If you need more details at this point, here they are.

To reproduce this bug, start netbeans and create a new project by going to file->new. select c/c++ from the left "categories" box and then pick c/c++ application from the right "projects" box. In the next window pick a name for the project and then hit the "finish" button.

Now that you have created a project, go to File->New File. Select c++ from the left "categories" box and then pick c++ header file from the right "File Types" box. Then press the "next" button, give the file any name and press the "Finish" button.

Add the following code the file:

class C {
    
private:
    int x;
};

It is important that your class have a member (this is why we have the "int x;" line above).
Now click your mouse so that your cursor is anywhere between the curly brackets and click on "Source->Insert code...". A context menu will open at the location of your cursor. Click on "Arithmetic Operators...". A window will appear. In that window, click the checkbox next to "operator/(const C& right) const : C". Then press the "Generate" button.
Comment 1 soldatov 2015-01-10 19:11:56 UTC
same bug in operator%() case
Comment 2 Alexander Simon 2015-01-12 09:42:53 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/8d154d2c57a9
Comment 3 Quality Engineering 2015-01-13 04:17:36 UTC
Integrated into 'main-silver', will be available in build *201501130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/8d154d2c57a9
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #249728 automatically generated division operator (operator/) multiplies instead of divides.