View Issue Details

IDProjectCategoryView StatusLast Update
0027563Open CASCADEOCCT:Foundation Classespublic2016-12-09 16:38
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version7.0.0 
Target Version7.1.0Fixed in Version7.1.0 
Summary0027563: Foundation Classes, opencascade::handle - make operator*() consistent with operator->()
DescriptionWhile operator->() always return non-const pointer, operator*() returns const reference for const handle object:
    //! STL-like cast to pointer to referred object
    const T* get () const { return static_cast<const T*>(this->entity); }

    //! STL-like cast to pointer to referred object
    T* get () { return static_cast<T*>(this->entity); }

    //! Member access operator (note non-const)
    T* operator-> () const { return static_cast<T*>(this->entity); }

    //! Dereferencing operator
    T& operator* () { return *get(); }

    //! Const dereferencing operator
    const T& operator*() const { return *get(); }

Since OCCT does not yet support handles to constant object, it is better to provide consistent behavior for both accessors.

Note that Handle declared for CDL have returned non-constant reference by operator*() within macros for derived classes, but not for Handle_Standard_Transient itself - I suppose the issue comes from here.

This also leads to one more compilation issue on porting to OCCT 7.0.0 in rare cases.
Steps To Reproduce
void DoSomething (const Handle(OpenGl_Context)& theCtx)
{
  OpenGl_Context& aCtx = *theCtx;
}
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0024023 closedabv Revamp the OCCT Handle 

Activities

git

2016-08-06 14:08

administrator   ~0056524

Branch CR27563 has been created by kgv.

SHA-1: 1bfb41ccc67095e58705d65c8a116fc2964ce0d2


Detailed log of new commits:

Author: kgv
Date: Sat Aug 6 14:07:54 2016 +0300

    0027563: Foundation Classes, opencascade::handle - make operator*() consistent with operator->()

kgv

2016-08-06 14:08

developer   ~0056525

Patch is ready for review.

abv

2016-08-08 11:47

manager   ~0056542

No remarks, please test

mkv

2016-08-08 19:40

tester   ~0056568

Dear BugMaster,
Branch CR27563 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 1bfb41ccc67095e58705d65c8a116fc2964ce0d2

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 64 (64 on master)
Windows: 0 (0 on master)
MacOS : 1149

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total MEMORY difference: 89401299 / 88470102 [+1.05%]
Total CPU difference: 19365.57 / 19248.95000000006 [+0.61%]
products component :
Total MEMORY difference: 30018525 / 30023278 [-0.02%]
Total CPU difference: 5080.90999999998 / 5098.489999999977 [-0.34%]

Testing on Windows:
occt component :
Total MEMORY difference: 57145984 / 57173794 [-0.05%]
Total CPU difference: 18201.011072398873 / 18044.994472298804 [+0.86%]
products component :
Total MEMORY difference: 21271479 / 21236271 [+0.17%]
Total CPU difference: 4890.100946599955 / 4792.459920699942 [+2.04%]

There are no differences in images found by testdiff.

mkv

2016-08-08 19:41

tester   ~0056569

Dear BugMaster,
Branch CR27563 is TESTED.

git

2016-08-26 16:24

administrator   ~0057156

Branch CR27563 has been deleted by inv.

SHA-1: 1bfb41ccc67095e58705d65c8a116fc2964ce0d2

Related Changesets

occt: master 9016c8bd

2016-08-06 11:07:54

kgv


Committer: bugmaster Details Diff
0027563: Foundation Classes, opencascade::handle - make operator*() consistent with operator->() Affected Issues
0027563
mod - src/Standard/Standard_Handle.hxx Diff File

Issue History

Date Modified Username Field Change
2016-06-02 17:04 kgv New Issue
2016-06-02 17:04 kgv Assigned To => abv
2016-08-06 14:07 kgv Summary Foundation Classes, opencascade::handle - operator*() should be consistent with operator->() => Foundation Classes, opencascade::handle - make operator*() consistent with operator->()
2016-08-06 14:08 git Note Added: 0056524
2016-08-06 14:08 kgv Note Added: 0056525
2016-08-06 14:08 kgv Status new => resolved
2016-08-06 14:09 kgv Relationship added related to 0024023
2016-08-08 11:47 abv Note Added: 0056542
2016-08-08 11:47 abv Assigned To abv => bugmaster
2016-08-08 11:47 abv Status resolved => reviewed
2016-08-08 12:32 mkv Assigned To bugmaster => mkv
2016-08-08 19:40 mkv Note Added: 0056568
2016-08-08 19:41 mkv Note Added: 0056569
2016-08-08 19:41 mkv Assigned To mkv => bugmaster
2016-08-08 19:41 mkv Status reviewed => tested
2016-08-08 19:41 mkv Test case number => Not needed
2016-08-12 10:48 bugmaster Changeset attached => occt master 9016c8bd
2016-08-12 10:48 bugmaster Status tested => verified
2016-08-12 10:48 bugmaster Resolution open => fixed
2016-08-26 16:24 git Note Added: 0057156
2016-12-09 16:31 aiv Status verified => closed
2016-12-09 16:38 aiv Fixed in Version => 7.1.0